52 Commits

Author SHA1 Message Date
sj a27b0c8deb 修复导出 2022-11-17 13:00:47 +08:00
sj c424bc0ca8 优化微信用户优化名 2022-11-15 13:50:03 +08:00
sj 010132f237 优化商品分类及子集查询 2022-11-14 16:26:07 +08:00
sj 91188fe1a0 优化优惠券显示并运行最小优惠券设置为无门槛 2022-11-14 13:58:03 +08:00
sj a5cdf202f1 下单时候自动选择优惠金额最大的优惠券 2022-11-14 11:10:22 +08:00
sj a30fb508de 修复优惠券被删除是用户券包报错 2022-11-11 16:27:49 +08:00
sj aa792a10b1 增加品牌搜索 2022-11-11 13:43:43 +08:00
sj bcdd99eb4a 增加商品id搜索,修复规格太长时,数据库报错 2022-11-10 17:19:52 +08:00
sj 50c1f73901 优惠券增加商品图片展示 2022-11-10 15:43:18 +08:00
sj 0d93550e43 增加拼团及砍价活动通知 2022-11-09 18:21:41 +08:00
sj 3b05b235bc 优化榜单排序及定时任务 2022-11-08 13:49:16 +08:00
sj 2fa9950933 修复榜单绑定商品删除问题 2022-11-07 10:56:44 +08:00
sj 76bd360e92 商品修改 2022-11-05 19:17:36 +08:00
sj f459579768 修改榜单页面 2022-11-05 19:16:21 +08:00
sj cb388c8e85 增加品牌馆滚动条 2022-11-03 16:13:47 +08:00
sj b26c158c84 修复专家排序及用户消息修改 2022-11-02 18:18:11 +08:00
sj 26f6a38c6b 领券增加消息推送,修复首页图 2022-11-02 17:06:12 +08:00
sj e80ff782e7 热榜增加时间字段配置 2022-11-01 14:22:57 +08:00
sj 44110bd059 商品增加无理由退款等配置 2022-10-31 18:33:07 +08:00
sj 9bc5869abd 修改订单支付及退款消息通知 2022-10-29 18:39:27 +08:00
sj 2b25c63f4e 品牌排序修改及商品删除下架时判断 2022-10-29 16:23:56 +08:00
sj 5f259398a2 修复订单生成 2022-10-29 10:42:53 +08:00
sj ddc1cddcb9 商品增加商品参数字段 2022-10-28 19:29:03 +08:00
sj a0a6040437 评测去除多余字段 2022-10-28 17:39:58 +08:00
sj f46f56e5b0 微信登录修复及品牌评测优化 2022-10-27 18:52:31 +08:00
sj b6a9c87e2a 会员等级增加成长值 2022-10-25 18:40:32 +08:00
sj ddb28dc5c8 修复优惠券部分 2022-10-25 16:01:42 +08:00
1304317391@qq.com 92e2c99b89 修复依赖错误 2022-10-22 13:33:31 +08:00
1304317391@qq.com a6cf439160 修复依赖错误 2022-10-22 13:12:01 +08:00
sj b0a0785501 优化流程 2022-10-21 19:03:11 +08:00
sj a22fa10cb8 增加评测收藏及订单支付成功群机器人 2022-10-19 18:14:15 +08:00
sj 200346ee71 修复物流状态查询 2022-10-18 14:16:16 +08:00
sj efa1a331bb 修复优惠券发布权限 2022-10-15 13:46:28 +08:00
sj 49d46c391a 修复专家和评测模块 2022-10-14 16:56:35 +08:00
Loki 69c9c00c16 👎 删除代码 2022-10-13 17:41:23 +08:00
sj 226518b3a4 跳过maven测试 2022-10-13 16:54:34 +08:00
sj e265d9620b 合并眼界甄选 2022-10-13 15:14:21 +08:00
sj 4180aa5567 修复因购物车改变引起的订单流程 2022-10-13 14:59:03 +08:00
sj e7bc4f312a 增加商品热榜设置,并购物车按品牌区分 2022-10-13 09:41:37 +08:00
sj 6d15e1fa32 修复小程序登录问题 2022-10-08 13:47:34 +08:00
sj aa8a171ccc 修复营销活动及会员等级 2022-09-30 17:31:08 +08:00
sj 6e7adc20cb 修改评测获取方法 2022-09-29 17:02:55 +08:00
sj 5bb10fe988 增加小程序请求商品词条接口 2022-09-29 11:43:54 +08:00
sj 37acc6ebae 修复小程序请求商品接口 2022-09-27 16:50:45 +08:00
sj ac911e41e1 增加小程序获取评测列表接口 2022-09-26 11:08:20 +08:00
sj 4f69fb5d3a 增加评测模块 2022-09-26 10:27:44 +08:00
sj 61eb0c7177 增加小程序端的专家和品牌查询接口 2022-09-20 16:29:01 +08:00
sj 1f07dde9d2 优惠券时间限制修改 2022-09-20 14:45:25 +08:00
sj 822d5e8207 完善专家模块 2022-09-19 16:58:26 +08:00
sj 0125a6598c 商品品牌修改 2022-09-17 18:44:43 +08:00
sj 173a6145af 修复商品品牌 2022-09-17 10:08:35 +08:00
sj 8d66f53be5 更改配置 2022-09-09 18:30:25 +08:00
295 changed files with 10603 additions and 411 deletions
View File
+6
View File
@@ -0,0 +1,6 @@
{
"name": "zsw-farm",
"lockfileVersion": 2,
"requires": true,
"packages": {}
}
+9
View File
@@ -51,6 +51,12 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<version>2.7.4</version>
<optional>true</optional>
</dependency>
</dependencies>
</dependencyManagement>
@@ -63,6 +69,9 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<!-- maven-compiler-plugin 插件,解决 Lombok + MapStruct 组合 -->
<plugin>
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

BIN
View File
Binary file not shown.
@@ -12,6 +12,21 @@
<artifactId>yudao-spring-boot-starter-flowable</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-full</artifactId> <!--注意-->
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-common</artifactId>
+5 -1
View File
@@ -33,7 +33,11 @@
<artifactId>zsw-erp</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>zsw-farm-impl</artifactId>
@@ -4,6 +4,7 @@ import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.system.ApplicationHome;
import org.springframework.scheduling.annotation.EnableScheduling;
import java.io.File;
@@ -243,7 +243,15 @@ dubbo:
bxg:
shop:
API_URL: http://192.168.10.129:48080/bxgApp
SITE_URL: http://192.168.10.129:48080/bxgApp
UNI_SITE_URL: http://192.168.10.129:48080/bxgApp
ADMIN_API_URL: http://192.168.10.129:48080/bxg
# API_URL: http://192.168.10.113:48080/bxgApp
API_URL: https://25eb-27-19-79-7.jp.ngrok.io
SITE_URL: http://192.168.10.113:48080/bxgApp
UNI_SITE_URL: http://192.168.10.113:48080/bxgApp
ADMIN_API_URL: http://192.168.10.113:48080/bxg
# 快递100 参数
kuaidi100:
enable: true
key: mmbOboEj7168
customer: A6D46C8A03A4127C78DF0E377D721702
secret: 13fcbe029263431293f5658cbf3259d3
userid: 79978ee033e640dca101450508620182
@@ -161,3 +161,10 @@ wxma:
spring:
jackson:
time-zone: GMT+8
# 快递100 参数
kuaidi100:
enable: true
key: mmbOboEj7168
customer: A6D46C8A03A4127C78DF0E377D721702
secret: 13fcbe029263431293f5658cbf3259d3
userid: 79978ee033e640dca101450508620182
+46 -1
View File
@@ -22,12 +22,41 @@
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-full</artifactId> <!--注意-->
<version>5.0.0</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-system-impl</artifactId>
<version>1.6.2-snapshot</version>
</dependency>
<dependency>
<groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>com.dtflys.forest</groupId>
<artifactId>forest-spring-boot-starter</artifactId>
<version>1.5.14</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-biz-weixin</artifactId>
@@ -63,6 +92,12 @@
<version>${revision}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<version>2.5.10</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-spring-boot-starter-security</artifactId>
@@ -155,6 +190,16 @@
<artifactId>fastjson</artifactId>
<version>1.2.50</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.12</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.14.2</version>
</dependency>
</dependencies>
@@ -74,7 +74,7 @@ public class PermissionInterceptor implements HandlerInterceptor {
Map<String, Claim> map = optionalMap
.orElseThrow(() -> new UnAuthenticatedException(ApiCode.UNAUTHORIZED));
String uName = map.get("uName").asString();
// String uName = map.get("uName").asString();
boolean valid = this.hasPermission(authCheck.get(), map);
@@ -92,12 +92,10 @@ public class AppStoreBargainController {
@ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
})
@ApiOperation(value = "砍价产品列表",notes = "砍价产品列表")
public ApiResult<Object> getYxStoreBargainPageList(@RequestParam(value = "page",defaultValue = "1") int page,
public ApiResult<Map<String,List<YxStoreBargainQueryVo>>> getYxStoreBargainPageList(@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "limit",defaultValue = "10") int limit){
return ApiResult.resultPage(storeBargainService.getList(page, limit),limit);
return ApiResult.ok(storeBargainService.getList(page, limit));
}
/**
* 砍价详情
*/
@@ -82,6 +82,21 @@ public class AppStoreCombinationController {
return ApiResult.ok(storeCombinationService.getList(page, limit));
}
/**
* 用户已发起的拼团的列表
*/
@GetMapping("/userCombination/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class),
@ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
})
@ApiOperation(value = "已发起的拼团的列表",notes = "已发起的拼团的列表")
public ApiResult<CombinationQueryVo> getUserCombinationList(@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "limit",defaultValue = "10") int limit){
return ApiResult.ok(storeCombinationService.getCombinationList(page, limit));
}
/**
* 拼团产品详情
*/
@@ -117,8 +117,12 @@ public class AppStoreSeckillController {
yxSystemGroupDataList.forEach(i -> {
String jsonStr = i.getValue();
JSONObject jsonObject = JSON.parseObject(jsonStr);
int time = Integer.valueOf(jsonObject.get("time").toString());//时间 5
int time = Integer.valueOf(jsonObject.get("time").toString());//开启时间(几点) 5
int continued = Integer.valueOf(jsonObject.get("continued").toString());//活动持续事件 3
String rule="";
if (jsonObject.get("rule")!=null){
rule=jsonObject.get("rule").toString();
}
SimpleDateFormat sdf = new SimpleDateFormat("HH");
String nowTime = sdf.format(new Date());
String index = nowTime.substring(0, 1);
@@ -131,23 +135,27 @@ public class AppStoreSeckillController {
seckillTimeDto.setState("即将开始");
seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00");
seckillTimeDto.setStatus(2);
seckillTimeDto.setRule(rule);
seckillTimeDto.setStop(today + activityEndHour * 3600);
} else {
if (currentHour >= time && currentHour < activityEndHour) {
seckillTimeDto.setState("抢购中");
seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00");
seckillTimeDto.setStatus(1);
seckillTimeDto.setRule(rule);
seckillTimeDto.setStop(today + activityEndHour * 3600);
seckillTimeIndex.set(yxSystemGroupDataList.indexOf(i));
} else if (currentHour < time) {
seckillTimeDto.setState("即将开始");
seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00");
seckillTimeDto.setStatus(2);
seckillTimeDto.setRule(rule);
seckillTimeDto.setStop(OrderUtil.dateToTimestamp(new Date()) + activityEndHour * 3600);
} else if (currentHour >= activityEndHour) {
seckillTimeDto.setState("已结束");
seckillTimeDto.setTime(jsonObject.get("time").toString().length() > 1 ? jsonObject.get("time").toString() + ":00" : "0" + jsonObject.get("time").toString() + ":00");
seckillTimeDto.setStatus(0);
seckillTimeDto.setRule(rule);
seckillTimeDto.setStop(today + activityEndHour * 3600);
}
}
@@ -0,0 +1,18 @@
package co.yixiang.app.modules.banner;
import lombok.Data;
@Data
public class Banner {
//首页标题
private String name;
//id
private String id;
//排序
private String sort;
//url链接
private String url;
//type
private Integer type;
}
@@ -29,6 +29,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -87,7 +88,7 @@ public class StoreCartController {
@AuthCheck
@GetMapping("/cart/list")
@ApiOperation(value = "购物车列表",notes = "购物车列表")
public ApiResult<Map<String,Object>> getList(){
public ApiResult<Map<String, ArrayList>> getList(){
Long uid = LocalUser.getUser().getUid();
return ApiResult.ok(storeCartService.getUserProductCartList(uid,"",null));
}
@@ -9,18 +9,24 @@
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 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;
import co.yixiang.modules.activity.vo.StoreCouponUserVo;
import co.yixiang.modules.activity.vo.YxStoreCouponIssueQueryVo;
import co.yixiang.modules.activity.vo.YxStoreCouponUserQueryVo;
import co.yixiang.app.modules.coupon.param.YxStoreCouponQueryParam;
import co.yixiang.modules.product.domain.YxStoreProduct;
import co.yixiang.modules.product.service.YxStoreProductService;
import co.yixiang.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
@@ -36,6 +42,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -56,8 +64,11 @@ public class CouponController {
private final YxStoreCouponIssueService couponIssueService;
private final YxStoreCouponUserService storeCouponUserService;
private final YxStoreCouponService storeCouponService;
private final YxStoreProductService yxStoreProductService;
/**
* 可领取优惠券列表
* 领券中心优惠券列表
*/
@AuthCheck
@GetMapping("/coupons")
@@ -67,7 +78,7 @@ public class CouponController {
@ApiImplicitParam(name = "productId", value = "产品ID", paramType = "query", dataType = "int",dataTypeClass = Integer.class),
@ApiImplicitParam(name = "type", value = "优惠券类型 0通用券 1商品券 2内部券", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
})
@ApiOperation(value = "可领取优惠券列表",notes = "可领取优惠券列表")
@ApiOperation(value = "领券中心优惠券列表",notes = "领券中心优惠券列表")
public ApiResult<List<YxStoreCouponIssueQueryVo>> getList(@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "limit",defaultValue = "10") int limit,
@RequestParam(value = "productId",required = false) Long productId,
@@ -76,6 +87,9 @@ public class CouponController {
return ApiResult.ok(couponIssueService.getCouponList(page, limit,uid,productId,type));
}
/**
* 领取优惠券
*/
@@ -107,6 +121,55 @@ public class CouponController {
return ApiResult.ok(list);
}
/**
* 用户已失效优惠券
*/
@AppLog(value = "查看用户已失效优惠券", type = 1)
@AuthCheck
@GetMapping("/coupons/userFailure/{type}")
@ApiOperation(value = "用户已失效优惠券",notes = "用户已失效优惠券")
public ApiResult<List<YxStoreCouponUserQueryVo>> getUserFailureList(){
Long uid = LocalUser.getUidByToken();
List<YxStoreCouponUserQueryVo> list = storeCouponUserService.getUserCoupon(uid);
List<YxStoreCouponUserQueryVo> list1 = new ArrayList<>();
for (YxStoreCouponUserQueryVo couponUser : list) {
//已失效 //已过期
if (couponUser.getIsFail() == 1||couponUser.getStatus() == 2){
list1.add(couponUser);
}
}
return ApiResult.ok(list1);
}
/**
* 用户可领取优惠券列表
*/
@AuthCheck
@GetMapping("/coupons/canReceive")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class),
@ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class),
@ApiImplicitParam(name = "productId", value = "产品ID", paramType = "query", dataType = "int",dataTypeClass = Integer.class),
@ApiImplicitParam(name = "type", value = "优惠券类型 0通用券 1商品券 2内部券", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
})
@ApiOperation(value = "用户可领取优惠券列表",notes = "用户可领取优惠券列表")
public ApiResult<List<YxStoreCouponIssueQueryVo>> canReceive(@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "limit",defaultValue = "10") int limit,
@RequestParam(value = "productId",required = false) Long productId,
@RequestParam(value = "type",required = false) Integer type){
Long uid = LocalUser.getUidByToken();
List<YxStoreCouponIssueQueryVo> list=couponIssueService.getCouponList(page, limit,uid,productId,type);
List<YxStoreCouponIssueQueryVo> list1 = new ArrayList<>();
for (YxStoreCouponIssueQueryVo couponIssue : list) {
if(!couponIssue.getIsUse()){
list1.add(couponIssue);
}
}
return ApiResult.ok(list1);
}
/**
* 用户已领取优惠券pc
*/
@@ -135,7 +198,27 @@ public class CouponController {
@ApiOperation(value = "优惠券订单获取",notes = "优惠券订单获取")
public ApiResult<List<StoreCouponUserVo>> orderCoupon(@PathVariable String cartIds){
Long uid = LocalUser.getUser().getUid();
return ApiResult.ok(storeCouponUserService.beUsableCouponList(uid,cartIds));
List<StoreCouponUserVo> list=storeCouponUserService.beUsableCouponList(uid,cartIds);
for (StoreCouponUserVo queryVo:list){
String[] idList =queryVo.getProductId().split(",");
List<String> needIdlist;
//因为最多只需要展示三个商品的图
if (idList.length>3){
needIdlist= Arrays.asList(Arrays.copyOf(idList, 3));
}else {
needIdlist= Arrays.asList(idList);
}
List<String> imageList=new ArrayList<>();
needIdlist.forEach(id->{
YxStoreProduct yxStoreProduct=yxStoreProductService.getById(id);
if (ObjectUtil.isNotEmpty(yxStoreProduct)&& StringUtils.isNotBlank(yxStoreProduct.getImage())){
imageList.add(yxStoreProductService.getById(id).getImage());
}
});
queryVo.setImage(imageList);
}
return ApiResult.ok(list);
// return ApiResult.ok(storeCouponUserService.beUsableCouponList(uid,cartIds));
}
@@ -0,0 +1,58 @@
package co.yixiang.app.modules.entry.rest;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.modules.entry.service.YxStoreEntryService;
import co.yixiang.utils.EntryDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
* 商品评测控制器
* </p>
*
* @author ssj
* @since 2022-9-27
*/
@Slf4j
@RestController
@Api(value = "查询词条讲解", tags = "商城:商品词条")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppStoreEntryController {
private final YxStoreEntryService yxStoreEntryService;
/**
* 查询词条讲解
*/
@AnonymousAccess
@GetMapping("/entry/{id}")
@ApiOperation(value = "词条id查询词条",notes = "词条")
public ApiResult<EntryDTO> getYxEntry(@PathVariable int id){
EntryDTO entryDTO=yxStoreEntryService.getEntry(id);
return ApiResult.ok(entryDTO);
}
/**
* 查询词条讲解
*/
@AnonymousAccess
@GetMapping("/entryByName")
@ApiOperation(value = "根据词条名查询词条",notes = "词条")
public ApiResult<EntryDTO> getEntryByName(String name){
EntryDTO entryDTO=yxStoreEntryService.getEntryByName(name);
return ApiResult.ok(entryDTO);
}
}
@@ -0,0 +1,18 @@
package co.yixiang.app.modules.evaluation.param;
import co.yixiang.common.web.param.QueryParam;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 评测表查询
* @author ssj
* @date 2022-9-27
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "YxEvaluationQueryParam对象",description ="评测表查询参数")
public class YxEvaluationQueryParam extends QueryParam {
private static final long serialVersionUID =1L;
}
@@ -0,0 +1,26 @@
package co.yixiang.app.modules.evaluation.param;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotBlank;
/**
* <p>
* 评测点赞和收藏表 查询参数对象
* </p>
*
* @author sj
* @date 2022-10-19
*/
@Getter
@Setter
@ApiModel("查询参数对象")
public class YxStoreEvaluationRelationQueryParam {
@NotBlank(message = "参数有误")
@ApiModelProperty(value = "商品id",required=true)
private String id;
}
@@ -0,0 +1,109 @@
/**
* Copyright (C) 2018-2022
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
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.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;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* <p>
* 商品评测控制器
* </p>
*
* @author ssj
* @since 2022-9-20
*/
@Slf4j
@RestController
@Api(value = "产品评测", tags = "商城:评测")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppStoreEvaluationController {
private final YxEvaluationService yxEvaluationService;
private final YxEvaluationRelationService yxEvaluationRelationService;
/**
* 评测列表
*/
@AnonymousAccess
@GetMapping("/evaluation")
@ApiOperation(value = "评测列表",notes = "产品评测")
public ApiResult<List<EvaluationDTO>> getYxEvaluationPageList(){
return ApiResult.ok(yxEvaluationService.getList());
}
/**
* 首页点击查询评测
*/
@AnonymousAccess
@GetMapping("/evaluation/{id}")
@ApiOperation(value = "评测查询",notes = "产品评测")
public ApiResult<EvaluationDTO> getYxEvaluation(@PathVariable int id){
long uid = LocalUser.getUidByToken();
EvaluationDTO evaluationDTO=yxEvaluationService.getEvaluationById(uid,id);
return ApiResult.ok(evaluationDTO);
}
/**
* 添加收藏
*/
@AppLog(value = "添加收藏", type = 1)
@NoRepeatSubmit
@AuthCheck
@PostMapping("/collectEvaluation/add")
@ApiOperation(value = "添加收藏",notes = "添加收藏")
public ApiResult<Boolean> collectAdd(@Validated @RequestBody YxStoreEvaluationRelationQueryParam param){
long uid = LocalUser.getUser().getUid();
if(!NumberUtil.isNumber(param.getId())) {
throw new YshopException("参数错误哦");
}
yxEvaluationRelationService.addEvaluationRelation(Long.valueOf(param.getId()),uid);
return ApiResult.ok();
}
/**
* 取消收藏
*/
@AppLog(value = "取消收藏", type = 1)
@NoRepeatSubmit
@AuthCheck
@PostMapping("/collectEvaluation/del")
@ApiOperation(value = "取消收藏",notes = "取消收藏")
public ApiResult<Boolean> collectDel(@Validated @RequestBody YxStoreEvaluationRelationQueryParam param){
long uid = LocalUser.getUser().getUid();
if(!NumberUtil.isNumber(param.getId())) {
throw new YshopException("参数错误哦");
}
yxEvaluationRelationService.delEvaluationRelation(Long.valueOf(param.getId()),
uid);
return ApiResult.ok();
}
}
@@ -0,0 +1,53 @@
/**
* Copyright (C) 2018-2022
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.app.modules.expert.rest;
import co.yixiang.annotation.AnonymousAccess;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import co.yixiang.modules.expert.service.YxStoreExpertService;
import co.yixiang.utils.ExpertDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
* 专家前端控制器
* </p>
*
* @author ssj
* @since 2022-9-20
*/
@Slf4j
@RestController
@Api(value = "店内专家", tags = "商城:专家")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppStoreExpertController {
private final YxStoreExpertService yxStoreExpertService;
/**
* 商品分类列表
*/
@AnonymousAccess
@GetMapping("/expert")
@ApiOperation(value = "专家列表",notes = "专家列表")
public ApiResult<List<ExpertDTO>> getYxStoreExpertPageList(){
return ApiResult.ok(yxStoreExpertService.getList());
}
}
@@ -0,0 +1,69 @@
package co.yixiang.app.modules.hotList.rest;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.app.modules.activity.param.YxStoreBargainUserHelpQueryParam;
import co.yixiang.modules.evaluation.service.YxEvaluationService;
import co.yixiang.modules.hotList.service.YxStoreHotListService;
import co.yixiang.modules.hotList.param.YxStoreHotListRecordQueryParam;
import co.yixiang.modules.product.domain.YxStoreProduct;
import co.yixiang.utils.EvaluationDTO;
import co.yixiang.utils.HotListDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* <p>
* 商品热榜控制器
* </p>
*
* @author ssj
* @since 2022-10-8
*/
@Slf4j
@RestController
@Api(value = "商品热门榜单", tags = "商城:热门榜单")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppStoreHotListController {
private final YxStoreHotListService yxStoreHotListService;
/**
* 热门榜单列表
*/
@AnonymousAccess
@GetMapping("/hotListData")
@ApiOperation(value = "榜单可选月及每月可选分类",notes = "榜单信息")
public ApiResult<Map<String,Object>> getYxStoreHotDataList(){
return ApiResult.ok(yxStoreHotListService.getHotListDataList());
}
/**
* 热门榜单列表
*/
@AnonymousAccess
@GetMapping("/hotList")
@ApiOperation(value = "榜单列表",notes = "热门榜单")
public ApiResult<List<YxStoreProduct>> getYxStoreHotListRecord(YxStoreHotListRecordQueryParam QueryParam){
return ApiResult.ok(yxStoreHotListService.getList(QueryParam));
}
/**
* 热门榜单列表
*/
@AnonymousAccess
@GetMapping("/indexHotList")
@ApiOperation(value = "首页的榜单内容",notes = "首页的榜单内容")
public ApiResult<List<HotListDTO>> getYxStoreHotList(){
return ApiResult.ok(yxStoreHotListService.getList());
}
}
@@ -16,8 +16,8 @@ import javax.validation.constraints.Size;
@Setter
public class ProductReplyParam {
@NotBlank(message = "评论不能为空")
@Size(min = 1, max = 200,message = "长度超过了限制")
// @NotBlank(message = "评论不能为空")
@Size(min = 0, max = 200,message = "长度超过了限制")
@ApiModelProperty(value = "商品评论内容")
private String comment;
@@ -32,14 +32,12 @@ import co.yixiang.modules.order.param.*;
import co.yixiang.modules.order.service.YxStoreOrderCartInfoService;
import co.yixiang.modules.order.service.YxStoreOrderService;
import co.yixiang.modules.order.service.YxStoreOrderStatusService;
import co.yixiang.modules.order.service.dto.YxStoreOrderDto;
import co.yixiang.modules.order.vo.ComputeVo;
import co.yixiang.modules.order.vo.ConfirmOrderVo;
import co.yixiang.modules.order.vo.OrderCartInfoVo;
import co.yixiang.modules.order.vo.YxStoreOrderQueryVo;
import co.yixiang.modules.user.domain.YxUser;
import co.yixiang.tools.express.ExpressService;
import co.yixiang.tools.express.config.ExpressAutoConfiguration;
import co.yixiang.tools.express.dao.ExpressInfo;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.vdurmont.emoji.EmojiParser;
@@ -54,6 +52,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.LinkedHashMap;
@@ -74,7 +73,7 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Api(value = "订单模块", tags = "商城:订单模块")
public class AppStoreOrderController {
private final ExpressService expressService;
private final YxStoreOrderService storeOrderService;
private final OrderSupplyService orderSupplyService;
private final CreatShareProductService creatShareProductService;
@@ -84,6 +83,7 @@ public class AppStoreOrderController {
private final YxStoreOrderCartInfoService storeOrderCartInfoService;
private final WeixinPayService weixinPayService;
/**
* 订单确认
*/
@@ -97,6 +97,7 @@ public class AppStoreOrderController {
}
/**
* 计算订单金额
*/
@@ -136,7 +137,7 @@ public class AppStoreOrderController {
@PostMapping("/order/create/{key}")
@ApiOperation(value = "订单创建", notes = "订单创建")
public ApiResult<Map<String, Object>> create(@Valid @RequestBody OrderParam param,
@PathVariable String key) {
@PathVariable String key) throws IOException {
YxUser yxUser = LocalUser.getUser();
ComputeOrderParam computeOrderParam = new ComputeOrderParam();
BeanUtil.copyProperties(param, computeOrderParam);
@@ -185,7 +186,7 @@ public class AppStoreOrderController {
@AuthCheck
@PostMapping("/order/pay")
@ApiOperation(value = "订单支付", notes = "订单支付")
public ApiResult<Map<String, Object>> pay(@Valid @RequestBody PayParam param) {
public ApiResult<Map<String, Object>> pay(@Valid @RequestBody PayParam param) throws IOException {
Map<String, Object> map = new LinkedHashMap<>();
Long uid = LocalUser.getUser().getUid();
YxStoreOrderQueryVo storeOrder = storeOrderService
@@ -230,7 +231,7 @@ public class AppStoreOrderController {
@AuthCheck
@GetMapping("/order/list")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "商品状态,-1全部 默认为0未支付 1待发货 2待收货 3待评价 4已完成 5退款中 6已退款 7退款",
@ApiImplicitParam(name = "type", value = "商品状态,-1全部 默认为0未支付 1待发货 2待收货 3待评价 4已完成 5退款中 6已退款 7退款 8已取消",
paramType = "query", dataType = "int",dataTypeClass = Integer.class),
@ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class),
@ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
@@ -375,7 +376,6 @@ public class AppStoreOrderController {
list.add("收到商品损坏了");
list.add("未按预定时间发货");
list.add("其它原因");
return ApiResult.ok(list);
}
@@ -431,23 +431,25 @@ public class AppStoreOrderController {
@ApiOperation(value = "获取物流信息", notes = "获取物流信息")
public ApiResult<ExpressInfo> express(@RequestBody ExpressParam expressInfoDo) {
//顺丰轨迹查询处理
String lastFourNumber = "";
if (expressInfoDo.getShipperCode().equals(ShipperCodeEnum.SF.getValue())) {
YxStoreOrderDto yxStoreOrderDto;
yxStoreOrderDto = storeOrderService.getOrderDetail(Long.valueOf(expressInfoDo.getOrderCode()));
lastFourNumber = yxStoreOrderDto.getUserPhone();
if (lastFourNumber.length() == 11) {
lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
}
}
ExpressService expressService = ExpressAutoConfiguration.expressService();
// //顺丰轨迹查询处理
// String lastFourNumber = "";
// if (expressInfoDo.getShipperCode().equals(ShipperCodeEnum.SF.getValue())) {
// YxStoreOrderDto yxStoreOrderDto;
// yxStoreOrderDto = storeOrderService.getOrderDetail(Long.valueOf(expressInfoDo.getOrderCode()));
// lastFourNumber = yxStoreOrderDto.getUserPhone();
// if (lastFourNumber.length() == 11) {
// lastFourNumber = StrUtil.sub(lastFourNumber, lastFourNumber.length(), -4);
// }
// }
//
// ExpressService expressService = ExpressAutoConfiguration.expressService();
// ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(),
// expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode(), lastFourNumber);
// if (!expressInfo.isSuccess()) {
// throw new YshopException(expressInfo.getReason());
// }
ExpressInfo expressInfo = expressService.getExpressInfo(expressInfoDo.getOrderCode(),
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode(), lastFourNumber);
if (!expressInfo.isSuccess()) {
throw new YshopException(expressInfo.getReason());
}
expressInfoDo.getShipperCode(), expressInfoDo.getLogisticCode());
return ApiResult.ok(expressInfo);
}
@@ -0,0 +1,76 @@
package co.yixiang.app.modules.product.rest;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import co.yixiang.annotation.AnonymousAccess;
import co.yixiang.modules.store.service.YxStoreBrandService;
import co.yixiang.modules.store.service.dto.YxStoreBrandNameDto;
import co.yixiang.utils.BrandDTO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* <p>
* 商品品牌前端控制器
* </p>
*
* @author ssj
* @since 2022-9-20
*/
@Slf4j
@RestController
@Api(value = "商品品牌", tags = "商城:商品品牌")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class AppStoreBrandController {
private final YxStoreBrandService yxStoreBrandService;
/**
* 商品品牌列表
*/
@AnonymousAccess
@GetMapping("/brand")
@ApiOperation(value = "商品品牌列表",notes = "商品品牌列表")
public ApiResult<List<BrandDTO>> getYxStoreBrandPageList(){
return ApiResult.ok(yxStoreBrandService.getList());
}
/**
* 品牌馆滚动条信息
*/
@AnonymousAccess
@GetMapping("/brandInfo")
@ApiOperation(value = "品牌馆滚动条信息",notes = "品牌馆滚动条信息")
public ApiResult<Object> getYxStoreBrandInfo(){
return ApiResult.ok(yxStoreBrandService.getBrandInfo());
}
/**
* 商品品牌列表按首字母分类
*/
@AnonymousAccess
@GetMapping("/brandByName")
@ApiOperation(value = "商品品牌列表",notes = "商品品牌列表")
public ApiResult<Map<String,List<BrandDTO>>> getListByName(){
return ApiResult.ok(yxStoreBrandService.getListByName());
}
/**
* 商品品牌列表
*/
@AnonymousAccess
@GetMapping("/brand/{id}")
@ApiOperation(value = "商品品牌详情",notes = "商品品牌详情")
public ApiResult<BrandDTO> getYxStoreBrandById(@PathVariable String id){
return ApiResult.ok(yxStoreBrandService.getYxStoreBrandById(id));
}
}
@@ -141,15 +141,23 @@ public class AppAuthService {
log.info("appId:{},secret:{}",appId,secret);
WxMaService wxMaService = WxMaConfiguration.getWxMaService();
WxMaJscode2SessionResult session = wxMaService.getUserService().getSessionInfo(code);
WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService()
.getPhoneNoInfo(session.getSessionKey(), encryptedData, iv);
YxUser yxUser = this.userService.getOne(Wrappers.<YxUser>lambdaQuery()
.eq(YxUser::getPhone, phoneNoInfo.getPhoneNumber()), false);
WxMaPhoneNumberInfo phoneNoInfo=new WxMaPhoneNumberInfo();
//防止仅有code时候调用解密方法报错
if (StringUtils.isBlank(encryptedData)&StringUtils.isBlank(iv)){
}else {
phoneNoInfo= wxMaService.getUserService()
.getPhoneNoInfo(session.getSessionKey(), encryptedData, iv);
}
YxUser yxUser ;
//手机号会员
yxUser=this.userService.getOne(Wrappers.<YxUser>lambdaQuery()
.eq(YxUser::getPhone,phoneNoInfo.getPhoneNumber()), false);
//openid会员
if (ObjectUtil.isNull(yxUser)){
yxUser = this.userService.getOne(Wrappers.<YxUser>lambdaQuery()
.eq(YxUser::getOpenId,session.getOpenid()),false);
}
if (ObjectUtil.isNull(yxUser)) {
//兼容旧系统
yxUser = this.userService.getOne(Wrappers.<YxUser>lambdaQuery()
.eq(YxUser::getUsername, session.getOpenid()), false);
@@ -158,10 +166,13 @@ public class AppAuthService {
//过滤掉表情
String ip = co.yixiang.app.common.util.IpUtil.getRequestIp();
yxUser = YxUser.builder()
.username(phoneNoInfo.getPhoneNumber())
.username(StringUtils.isNotBlank(phoneNoInfo.getPhoneNumber())?phoneNoInfo.getPhoneNumber():session.getOpenid())
// .username(phoneNoInfo.getPhoneNumber())
.phone(phoneNoInfo.getPhoneNumber())
.addIp(ip)
.openId(session.getOpenid())
.lastIp(ip)
.nickname(StringUtils.isNotBlank(phoneNoInfo.getPhoneNumber())?phoneNoInfo.getPhoneNumber():session.getOpenid())
.userType(AppFromEnum.ROUNTINE.getValue())
.build();
@@ -42,6 +42,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@@ -174,14 +175,13 @@ public class OrderSupplyService {
* @return map
*/
public Map<String, Object> goPay(Map<String, Object> map, String orderId, Long uid, String payType,
String from, OrderExtendDto orderDTO){
String from, OrderExtendDto orderDTO) throws IOException {
switch (PayTypeEnum.toType(payType)){
case WEIXIN:
Map<String,String> jsConfig = new HashMap<>();
if(AppFromEnum.WEIXIN_H5.getValue().equals(from)){
WxPayMwebOrderResult wxPayMwebOrderResult = (WxPayMwebOrderResult)weixinPayService
.unifyPay(orderId,from, BillDetailEnum.TYPE_3.getValue(),"H5商品购买");
log.info("wxPayMwebOrderResult:{}",wxPayMwebOrderResult);
jsConfig.put("mweb_url",wxPayMwebOrderResult.getMwebUrl());
orderDTO.setJsConfig(jsConfig);
@@ -14,10 +14,12 @@ import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import co.yixiang.constant.ShopConstants;
import co.yixiang.enums.ProductEnum;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.modules.activity.service.YxStoreCombinationService;
import co.yixiang.modules.activity.service.YxStoreSeckillService;
import co.yixiang.modules.canvas.domain.StoreCanvas;
import co.yixiang.modules.canvas.service.StoreCanvasService;
import co.yixiang.modules.evaluation.service.YxEvaluationService;
import co.yixiang.modules.mp.service.YxWechatLiveService;
import co.yixiang.modules.product.service.YxStoreProductService;
import co.yixiang.modules.product.vo.YxSystemStoreQueryVo;
@@ -34,13 +36,16 @@ 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;
@@ -50,6 +55,7 @@ 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;
@@ -68,6 +74,7 @@ public class BxgIndexController {
private final YxAppVersionService appVersionService;
private final YxSystemGroupDataService systemGroupDataService;
private final YxStoreProductService storeProductService;
private final YxEvaluationService evaluationService;
private final YxSystemStoreService systemStoreService;
private final YxStoreCombinationService storeCombinationService;
private final YxStoreSeckillService storeSeckillService;
@@ -84,19 +91,29 @@ public class BxgIndexController {
.orderByDesc(StoreCanvas::getCanvasId).last("limit 1"));
return new ResponseEntity<>(canvas, HttpStatus.OK);
}
@Cacheable(cacheNames = ShopConstants.ZSW_REDIS_INDEX_KEY)
@GetMapping("/index")
@ApiOperation(value = "首页数据",notes = "首页数据")
public ApiResult<IndexVo> index(){
ArrayList list=new ArrayList<>();
systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_BANNER).forEach(banner->{
// 如果没有类型认定为首页图,0也认为是首页图
if (banner.get("type")==null||banner.get("type").equals(0)){
list.add(banner);
}
});
IndexVo indexVo = IndexVo.builder()
.banner(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_BANNER))
//首页图
// .banner(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_BANNER))
.banner(list)
.bastList(storeProductService.getList(1,6, ProductEnum.TYPE_1.getValue()))
.evaluationList(evaluationService.getList(1,5))
.benefit(storeProductService.getList(1,100,ProductEnum.TYPE_4.getValue()))
.combinationList(storeCombinationService.getList(1,8).getStoreCombinationQueryVos())
.firstList(storeProductService.getList(1,6,ProductEnum.TYPE_3.getValue()))
.likeInfo(storeProductService.getList(1,80,ProductEnum.TYPE_2.getValue()))
.mapKey(systemConfigService.getData(ShopKeyUtils.getTengXunMapKey()))
//菜单
.menus(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_MENUS))
.roll(systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_ROLL_NEWS))
.seckillList(storeSeckillService.getList(1, 4))
@@ -2,6 +2,8 @@ package co.yixiang.app.modules.shop.vo;
import co.yixiang.modules.activity.vo.YxStoreCombinationQueryVo;
import co.yixiang.modules.activity.vo.YxStoreSeckillQueryVo;
import co.yixiang.modules.evaluation.service.dto.YxEvaluationDto;
import co.yixiang.modules.evaluation.vo.YxEvaluationQueryVo;
import co.yixiang.modules.mp.service.dto.YxWechatLiveDto;
import co.yixiang.modules.product.vo.YxStoreProductQueryVo;
import com.alibaba.fastjson.JSONObject;
@@ -39,6 +41,9 @@ public class IndexVo implements Serializable {
//热门榜单
@ApiModelProperty("热门榜单")
private List<YxStoreProductQueryVo> likeInfo;
//评测列表
@ApiModelProperty("评测列表")
private List<YxEvaluationQueryVo> evaluationList;
//滚动
@ApiModelProperty("滚动")
private List<JSONObject> roll;
@@ -6,6 +6,7 @@ import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;
/**
* @ClassName UserEditParam
@@ -15,14 +16,17 @@ import java.io.Serializable;
@Data
public class UserEditParam implements Serializable {
@NotBlank(message = "请上传头像")
// @NotBlank(message = "请上传头像")
@ApiModelProperty(value = "用户头像")
private String avatar;
@NotBlank(message = "请填写昵称")
@Size(min = 1, max = 60,message = "长度超过限制")
// @NotBlank(message = "请填写昵称")
@Size(max = 60,message = "长度超过限制")
@ApiModelProperty(value = "用户昵称")
private String nickname;
// @NotBlank(message = "请上传头像")
@ApiModelProperty(value = "用户头像")
private String birthday;
}
@@ -0,0 +1,45 @@
package co.yixiang.app.modules.user.rest;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.tools.domain.QiniuContent;
import co.yixiang.tools.service.QiNiuService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
@RestController
@RequestMapping("/api/upload")
public class AppUploadController {
@Autowired
private YxSystemConfigService systemConfigService;
@Autowired
private QiNiuService qiNiuService;
@ApiOperation("上传文件")
@PostMapping
public ApiResult<?> create(@RequestParam(defaultValue = "") String name,
@RequestParam(defaultValue = "") String type,
@RequestParam("file") MultipartFile[] files) {
StringBuilder url = new StringBuilder();
for (MultipartFile file : files) {
QiniuContent qiniuContent = qiNiuService.upload(file, qiNiuService.find());
if ("".equals(url.toString())) {
url = url.append(qiniuContent.getUrl());
System.out.println("".equals(url.toString()));
}else{
url = url.append(",").append(qiniuContent.getUrl());
}
}
return ApiResult.ok(url);
}
}
@@ -9,6 +9,7 @@
package co.yixiang.app.modules.user.rest;
import cn.hutool.core.date.DateTime;
import cn.iocoder.yudao.framework.common.pojo.ApiResult;
import co.yixiang.app.common.aop.NoRepeatSubmit;
import co.yixiang.app.common.bean.LocalUser;
@@ -17,6 +18,8 @@ import co.yixiang.app.modules.user.param.UserEditParam;
import co.yixiang.logging.aop.log.AppLog;
import co.yixiang.constant.ShopConstants;
import co.yixiang.enums.BillInfoEnum;
import co.yixiang.modules.evaluation.service.YxEvaluationRelationService;
import co.yixiang.modules.evaluation.vo.YxStoreEvaluationRelationQueryVo;
import co.yixiang.modules.order.service.YxStoreOrderService;
import co.yixiang.modules.order.vo.UserOrderCountVo;
import co.yixiang.modules.product.service.YxStoreProductRelationService;
@@ -29,6 +32,8 @@ import co.yixiang.modules.user.service.YxUserService;
import co.yixiang.modules.user.service.YxUserSignService;
import co.yixiang.modules.user.vo.SignVo;
import co.yixiang.modules.user.vo.YxUserQueryVo;
import co.yixiang.utils.StringUtils;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Maps;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -38,15 +43,9 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import static co.yixiang.constant.SystemConfigConstants.YSHOP_SHOW_RECHARGE;
@@ -68,6 +67,7 @@ public class LetterAppUserController {
private final YxSystemGroupDataService systemGroupDataService;
private final YxStoreOrderService orderService;
private final YxStoreProductRelationService relationService;
private final YxEvaluationRelationService evaluationRelationService;
private final YxUserSignService userSignService;
private final YxUserBillService userBillService;
private final YxSystemConfigService systemConfigService;
@@ -95,8 +95,48 @@ public class LetterAppUserController {
return ApiResult.ok(map);
}
/**
* 获取各类轮播图
*/
@GetMapping("/menu/banner/{type}")
@ApiOperation(value = "获取各种轮播图(0:首页 1:品牌馆 2:优惠券 3:活动专区 4:榜单列表)",notes = "获取轮播图")
public ApiResult<Map<String,Object>> bannerMenu(@PathVariable Integer type){
Map<String,Object> map = new LinkedHashMap<>();
// map.put("banner",systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_BANNER));
List<JSONObject> list=systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_BANNER);
ArrayList bannerList=new ArrayList<>();
list.forEach(item->{
if(item.get("type")==type){
bannerList.add(item);
}
});
map.put("banner",bannerList);
return ApiResult.ok(map);
}
/**
* 获取常见问答
*/
@GetMapping("/menu/problem")
@ApiOperation(value = "获取常见问答",notes = "获取常见问答")
public ApiResult<Map<String,Object>> problem(){
Map<String,Object> map = new LinkedHashMap<>();
map.put("routine_problem",systemGroupDataService.getDatas(ShopConstants.ZSW_HOME_PROBLEM));
return ApiResult.ok(map);
}
/**
* 获取关于我们
*/
@GetMapping("/menu/aboutUs")
@ApiOperation(value = "获取关于我们",notes = "获取关于我们")
public ApiResult<Map<String,Object>> aboutUs(){
Map<String,Object> map = new LinkedHashMap<>();
map.put("routine_aboutUs",systemConfigService.getData(ShopConstants.ZSW_HOME_ABOUTUS));
return ApiResult.ok(map);
}
/**
* 订单统计数据
*/
@@ -127,6 +167,26 @@ public class LetterAppUserController {
return ApiResult.ok(relationService.userCollectProduct(page,limit,uid,type));
}
/**
* 获取收藏评测
*/
@AuthCheck
@GetMapping("/collectEvaluation/user")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "页码,默认为1", paramType = "query", dataType = "int",dataTypeClass = Integer.class),
@ApiImplicitParam(name = "limit", value = "页大小,默认为10", paramType = "query", dataType = "int",dataTypeClass = Integer.class),
@ApiImplicitParam(name = "type", value = "collect为收藏", paramType = "query", dataType = "String",dataTypeClass = String.class)
})
@ApiOperation(value = "获取收藏的评测",notes = "获取收藏的评测")
public ApiResult<List<YxStoreEvaluationRelationQueryVo>> collectEvaluationUser(@RequestParam(value = "page",defaultValue = "1") int page,
@RequestParam(value = "limit",defaultValue = "10") int limit,
@RequestParam(value = "type") String type){
Long uid = LocalUser.getUser().getUid();
List list=evaluationRelationService.userCollectEvaluation(page,limit,uid,type);
// return ApiResult.ok(evaluationRelationService.userCollectEvaluation(page,limit,uid,type));
return ApiResult.ok(list);
}
/**
* 用户资金统计
*/
@@ -224,9 +284,15 @@ public class LetterAppUserController {
@ApiOperation(value = "用户修改信息",notes = "用修改信息")
public ApiResult<Object> edit(@Validated @RequestBody UserEditParam param){
YxUser yxUser = LocalUser.getUser();
yxUser.setAvatar(param.getAvatar());
yxUser.setNickname(param.getNickname());
if (StringUtils.isNotBlank(param.getAvatar())){
yxUser.setAvatar(param.getAvatar());
}
if (StringUtils.isNotBlank(param.getNickname())){
yxUser.setNickname(param.getNickname());
}
if (StringUtils.isNotBlank(param.getBirthday())){
yxUser.setBirthday(param.getBirthday());
}
yxUserService.updateById(yxUser);
return ApiResult.ok("修改成功");
@@ -9,6 +9,7 @@
package co.yixiang.app.modules.wechat.rest.controller;
import cn.binarywang.wx.miniapp.api.WxMaService;
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;
@@ -94,11 +95,15 @@ public class WxMaUserController {
WxMaService wxMaService = WxMaConfiguration.getWxMaService();
String phone = "";
try {
String sessionKey = systemConfigService.getData(ShopConstants.ZSW_MINI_SESSION_KET + user.getUid());
// String sessionKey = systemConfigService.getData(ShopConstants.ZSW_MINI_SESSION_KET + user.getUid());
WxMaJscode2SessionResult session = wxMaService.getUserService()
.getSessionInfo(param.getCode());
WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService()
.getPhoneNoInfo(sessionKey, param.getEncryptedData(), param.getIv());
.getPhoneNoInfo(session.getSessionKey(), param.getEncryptedData(), param.getIv());
phone = phoneNoInfo.getPhoneNumber();
user.setPhone(phone);
user.setUsername(phone);//默认没绑手机号的用户username是openId,绑定手机号时候也修改为手机号
userService.updateById(user);
} catch (Exception e) {
e.printStackTrace();
@@ -15,6 +15,10 @@ import javax.validation.constraints.NotBlank;
@Setter
public class WxPhoneParam {
@NotBlank(message = "code参数缺失")
@ApiModelProperty(value = "小程序登陆code")
private String code;
@ApiModelProperty(value = "小程序完整用户信息的加密数据")
private String encryptedData;
@@ -25,19 +25,19 @@ public abstract class QueryParam implements Serializable{
private String keyword;
@ApiModelProperty(value = "当前第几页")
public void setCurrent(Integer current) {
if (current == null || current <= 0){
public void setPage(Integer page) {
if (page == null || page <= 0){
this.page = 1;
}else{
this.page = current;
this.page = page;
}
}
public void setSize(Integer size) {
if (size == null || size <= 0){
public void setLimit(Integer limit) {
if (limit == null || limit <= 0){
this.limit = 10;
}else{
this.limit = size;
this.limit = limit;
}
}
@@ -91,6 +91,21 @@ public interface ShopConstants {
* 首页banner
*/
String ZSW_HOME_BANNER = "zsw_home_banner";
/**
* 常见问答
*/
String ZSW_HOME_PROBLEM = "zsw_home_problem";
/**
* 关于我们
*/
String ZSW_HOME_ABOUTUS = "aboutUS";
/**
* 品牌馆首页滚动条
*/
String ZSW_BRAND_INDEX = "brandIndex";
/**
* 首页菜单
*/
@@ -102,7 +117,7 @@ public interface ShopConstants {
/**
* 热门搜索
*/
String ZSW_HOT_SEARCH = "zsw_hot_search";
String ZSW_HOT_SEARCH = "yshop_hot_search";
/**
* 个人中心菜单
*/
@@ -110,11 +125,11 @@ public interface ShopConstants {
/**
* 秒杀时间段
*/
String ZSW_SECKILL_TIME = "zsw_seckill_time";
String ZSW_SECKILL_TIME = "yshop_seckill_time";
/**
* 签到天数
*/
String ZSW_SIGN_DAY_NUM = "zsw_sign_day_num";
String ZSW_SIGN_DAY_NUM = "yshop_sign_day_num";
/**
* 打印机配置
@@ -171,6 +186,15 @@ public interface ShopConstants {
String ZSW_WECHAT_PUSH_REMARK = "回乡欢迎您!";
String SHOP_WECHAT_PUSH_REMARK = "获得1张新的优惠券,快来看看吧";
String SHOP_WECHAT_NEAR_COUPON = "您领取的券即将到期,请尽快使用";
String SHOP_WECHAT_BARGAIN_RESULT_SUCCESS = "恭喜您,本次砍价活动成功,快去最低价购买吧";
String SHOP_WECHAT_BARGAIN_RESULT_FAIL = "很遗憾,本次砍价活动失败";
String SHOP_WECHAT_COMBINATION_RESULT_SUCCESS = "恭喜您,本次拼团活动成功,商品将安排配送";
String SHOP_WECHAT_COMBINATION_RESULT_FAIL = "很遗憾,本次拼团活动失败";
String DEFAULT_UNI_H5_URL = "https://www.lotus-wallet.com";
String ZSW_MINI_SESSION_KET = "zsw:session_key:";
@@ -1,6 +1,11 @@
package co.yixiang.constant;
public class SystemConfigConstants {
//机器人链接地址
public final static String ROBOT_URL="robotUrl";
//机器人消息跳转网址
public final static String CARD_ACTION_URL="cardActionUrl";
//地址配置
public final static String API="api";
public final static String API_URL="api_url";
@@ -24,7 +24,7 @@ public enum OrderInfoEnum {
STATUS_1(1,"待收货"),
STATUS_2(2,"已收货"),
STATUS_3(3,"已完成"),
STATUS_8(3,"已取消"),
PAY_STATUS_0(0,"未支付"),
PAY_STATUS_1(1,"已支付"),
@@ -24,6 +24,7 @@ public enum OrderStatusEnum {
STATUS_2(2,"待收货"),
STATUS_3(3,"待评价"),
STATUS_4(4,"已完成"),
STATUS_8(8,"已取消"),
STATUS_MINUS_1(-1,"退款中"),
STATUS_MINUS_2(-2,"已退款"),
STATUS_MINUS_3(-3,"退款");
@@ -6,6 +6,8 @@ import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import java.math.BigDecimal;
/**
* @ClassName TemplateBean
* @Author hupeng <610796224@qq.com>
@@ -24,10 +26,18 @@ public class TemplateBean {
private String deliveryName;
private String deliveryId;
private String payType;
private Long productId; //商品名字
private Boolean result;
private Long uid;
private BigDecimal payPrice; //拼团活动实付金额
private BigDecimal refundPrice; //拼团活动退款金额
/**
* 提现申请ID
*/
private Long extractId;
/**
* 获得优惠券id
*/
private Integer couponId;
}
@@ -22,7 +22,12 @@ public enum TemplateListenEnum {
TYPE_6("6","商家收款通知"),
TYPE_7("7","用户下单未支付通知"),
TYPE_8("8","用户提现通知"),
TYPE_9("9","退款申请通知");
TYPE_9("9","退款申请通知"),
TYPE_10("10","用户获得优惠券后发送订阅通知"),
TYPE_11("11","用户优惠券将过期发送推送"),
TYPE_12("12","用户发起砍价活动结果通知"),
TYPE_13("13","用户参加拼团活动结果通知");
private String value;
private String desc;
@@ -10,6 +10,7 @@ import cn.hutool.core.bean.copier.CopyOptions;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDomain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@@ -203,6 +204,11 @@ public class YxStoreBargain extends BaseDomain {
private Integer share;
/** 运费模板ID */
@JsonProperty("temp_id")
@ApiModelProperty(value = "运费模板ID")
private Long tempId;
public void copy(YxStoreBargain source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
@@ -7,6 +7,7 @@ package co.yixiang.modules.activity.domain;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.date.DateTime;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDomain;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@@ -19,6 +20,7 @@ import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.sql.Timestamp;
/**
* @author hupeng
@@ -60,11 +62,25 @@ public class YxStoreCoupon extends BaseDomain {
private BigDecimal useMinPrice;
/** 优惠券有效期限(单位:天) */
@NotNull(message = "请输入有效期限")
@ApiModelProperty(value = "优惠券有效期限(单位:天)")
private Integer couponTime;
// /** 优惠券有效期限(单位:天) */
// @NotNull(message = "请输入有效期限")
// @ApiModelProperty(value = "优惠券有效期限(单位:天)")
// private Integer couponTime;
// /** 优惠券有效期限(单位:天) */
// @NotNull(message = "请输入有效期限")
// @ApiModelProperty(value = "优惠券有效期限(单位:天;几号到几号)")
// private Object useTime;
/** 优惠券开始使用时间 */
@NotNull(message = "请输入开始期限")
@ApiModelProperty(value = "优惠券开始使用时间")
private String useStartTime;
/** 优惠券结束使用时间 */
@NotNull(message = "请输入有效结束期限")
@ApiModelProperty(value = "优惠券结束使用时间")
private String useEndTime;
/** 排序 */
@ApiModelProperty(value = "排序")
@@ -16,6 +16,7 @@ import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Date;
@@ -30,6 +31,7 @@ import java.util.Date;
@AllArgsConstructor
@NoArgsConstructor
@TableName("yx_store_coupon_user")
@Service
public class YxStoreCouponUser extends BaseDomain {
/** 优惠券发放记录id */
@@ -63,14 +65,17 @@ public class YxStoreCouponUser extends BaseDomain {
private BigDecimal useMinPrice;
/** 优惠券结束时间 */
@ApiModelProperty(value = "优惠券结束时间")
private Date endTime;
/** 优惠券有效期结束时间 */
@ApiModelProperty(value = "优惠券有效期结束时间")
private Date useEndTime;
/** 优惠券有效期开始时间 */
@ApiModelProperty(value = "优惠券有效期开始时间")
private Date useStartTime;
/** 使用时间 */
@ApiModelProperty(value = "使用时间")
private Date useTime;
// /** 使用时间 */
// @ApiModelProperty(value = "使用时间")
// private Date useTime;
/** 获取方式 */
@@ -61,12 +61,13 @@ public class StoreCouponController {
&& StrUtil.isEmpty(resources.getProductId())){
throw new YshopException("请选择商品");
}
if(resources.getCouponPrice().compareTo(resources.getUseMinPrice()) >= 0) {
throw new YshopException("优惠券金额不能高于最低消费金额");
}
// if(resources.getCouponPrice().compareTo(resources.getUseMinPrice()) >= 0) {
// throw new YshopException("优惠券金额不能高于最低消费金额");
// }
return new ResponseEntity<>(yxStoreCouponService.save(resources),HttpStatus.CREATED);
}
@Log("修改")
@ApiOperation(value = "修改")
@PutMapping(value = "/yxStoreCoupon")
@@ -76,9 +77,10 @@ public class StoreCouponController {
&& StrUtil.isEmpty(resources.getProductId())){
throw new YshopException("请选择商品");
}
if(resources.getCouponPrice().compareTo(resources.getUseMinPrice()) >= 0) {
throw new YshopException("优惠券金额不能高于最低消费金额");
}
// if(resources.getCouponPrice().compareTo(resources.getUseMinPrice()) >= 0) {
// throw new YshopException("优惠券金额不能高于最低消费金额");
// }
//这里需要对优惠券开始使用时间和结束时间进行比较
yxStoreCouponService.saveOrUpdate(resources);
return new ResponseEntity(HttpStatus.NO_CONTENT);
}
@@ -52,7 +52,8 @@ public class StoreCouponIssueController {
@Log("发布")
@ApiOperation(value = "发布")
@PostMapping(value = "/yxStoreCouponIssue")
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTORECOUPONISSUE_ALL','YXSTORECOUPONISSUE_CREATE')")
// @PreAuthorize("@ss.hasAnyPermissions('admin','YXSTORECOUPONISSUE_ALL','YXSTORECOUPONISSUE_CREATE')")
@PreAuthorize("@ss.hasAnyPermissions('admin','YXSTORECOUPON_ALL','YXSTORECOUPON_EDIT')")
public ResponseEntity create(@Validated @RequestBody YxStoreCouponIssue resources){
if(resources.getTotalCount() > 0) {
resources.setRemainCount(resources.getTotalCount());
@@ -91,9 +91,9 @@ public interface YxStoreBargainService extends BaseService<YxStoreBargain>{
* @param limit limit
* @return List
*/
List<YxStoreBargainQueryVo> getList(int page, int limit);
Map<String,List<YxStoreBargainQueryVo>> getList(int page, int limit);
// List<YxStoreBargainQueryVo> getUserBargainList(int page, int limit);
/**
* 查询数据分页
* @param criteria 条件
@@ -122,4 +122,6 @@ public interface YxStoreBargainService extends BaseService<YxStoreBargain>{
* @param id
*/
void deleteBargainImg(String id);
}
@@ -84,6 +84,14 @@ public interface YxStoreBargainUserService extends BaseService<YxStoreBargainUse
* @return int
*/
Long getBargainUserCount(Long bargainId,Integer status);
/**
* 获取参与砍价的用户数量
* @param bargainId 砍价id
* @param uid 状态 OrderInfoEnum 1 进行中 2 结束失败 3结束成功
* @param uid 用户是否正在参加该活动
* @return int
*/
Boolean getUserIsParticipation(Long uid,Long bargainId);
}
@@ -38,6 +38,7 @@ public interface YxStoreCombinationService extends BaseService<YxStoreCombinati
*/
CombinationQueryVo getList(int page, int limit);
CombinationQueryVo getCombinationList(int page, int limit);
/**
* 获取拼团详情
* @param id 拼团产品id
@@ -77,4 +78,6 @@ public interface YxStoreCombinationService extends BaseService<YxStoreCombinati
void onSale(Long id, Integer status);
boolean saveCombination(YxStoreCombinationDto resources);
}
@@ -22,6 +22,9 @@ public class SeckillTimeDto {
@ApiModelProperty(value = "秒杀产品状态")
private Integer status;
@ApiModelProperty(value = "秒杀规则")
private String rule;
@ApiModelProperty(value = "秒杀产品停止时间")
private Integer stop;
}
@@ -99,6 +99,9 @@ public class YxStoreBargainDto implements Serializable {
/** 邮费 */
private BigDecimal postage;
/** 运费模板 */
private Long tempId;
/** 砍价规则 */
private String rule;
@@ -5,12 +5,14 @@
*/
package co.yixiang.modules.activity.service.dto;
import cn.hutool.core.date.DateTime;
import co.yixiang.modules.product.domain.YxStoreProduct;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
@@ -36,8 +38,16 @@ public class YxStoreCouponDto implements Serializable {
// 最低消费多少金额可用优惠券
private BigDecimal useMinPrice;
// 优惠券有效期限(单位:天)
private Integer couponTime;
// // 优惠券有效期限(单位:天)
// private Integer couponTime;
// 优惠券有效期开始时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private DateTime useStartTime;
// 优惠券有效期开始时间
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private DateTime useEndTime;
// 排序
private Integer sort;
@@ -42,10 +42,12 @@ public class YxStoreCouponUserDto implements Serializable {
private Date addTime;
// 优惠券结束时间
private Date endTime;
private Date useEndTime;
// 使用时间
private Date useTime;
// 优惠券结束时间
private Date useStartTime;
// // 使用时间
// private Date useTime;
// 获取方式
private String type;
@@ -8,13 +8,21 @@
*/
package co.yixiang.modules.activity.service.impl;
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 co.yixiang.app.common.bean.LocalUser;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.event.TemplateBean;
import co.yixiang.event.TemplateEvent;
import co.yixiang.event.TemplateListenEnum;
import co.yixiang.exception.BadRequestException;
import co.yixiang.modules.activity.domain.YxStoreBargain;
import co.yixiang.modules.activity.domain.YxStoreBargainUser;
import co.yixiang.modules.activity.domain.YxStoreBargainUserHelp;
@@ -28,8 +36,14 @@ 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;
import co.yixiang.modules.product.service.mapper.StoreProductMapper;
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.modules.user.vo.YxUserQueryVo;
import co.yixiang.utils.FileUtil;
@@ -38,6 +52,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@@ -46,12 +61,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
@@ -68,7 +78,8 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
@Autowired
private YxStoreBargainMapper yxStoreBargainMapper;
@Autowired
private ApplicationEventPublisher publisher;
@Autowired
private YxStoreBargainUserService storeBargainUserService;
@Autowired
@@ -76,8 +87,16 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
@Autowired
private YxStoreBargainUserHelpService storeBargainUserHelpService;
@Autowired
private StoreProductMapper storeProductMapper;
@Autowired
private YxSystemConfigService systemConfigService;
@Autowired
private YxShippingTemplatesService shippingTemplatesService;
@Autowired
private YxStoreProductService yxStoreProductService;
/**
* 退回库存销量
* @param num 数量
@@ -124,7 +143,6 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
YxStoreBargainUser storeBargainUser = storeBargainUserService
.getBargainUserInfo(bargainId,bargainUserUid);
YxStoreBargain storeBargain = this.getById(bargainId);
//用户可以砍掉的金额 好友砍价之前获取可以砍价金额
double coverPrice = NumberUtil.sub(storeBargainUser.getBargainPrice()
@@ -139,7 +157,6 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
return;
}
//生成一个区间随机数
random = OrderUtil.randomNumber(
storeBargain.getBargainMinPrice().doubleValue(),
@@ -169,7 +186,17 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
.id(storeBargainUser.getId())
.price(BigDecimal.valueOf(totalPrice))
.build();
//如果砍价完成这里为砍价发起人进行订阅推送
if (totalPrice==coverPrice){
TemplateBean templateBean = TemplateBean.builder()
.productId(storeBargain.getProductId())
.uid(storeBargainUser.getUid())
.result(true)
.templateType(TemplateListenEnum.TYPE_12.getValue())
.time(DateUtil.formatTime(new Date()))
.build();
publisher.publishEvent(new TemplateEvent(this, templateBean));
}
storeBargainUserService.updateById(bargainUser);
}
@@ -281,17 +308,34 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
if(storeBargain == null) {
throw new YshopException("砍价已结束");
}
// 获取运费模板名称
String storeFreePostage = systemConfigService.getData("store_free_postage");
String tempName = "";
if(StrUtil.isBlank(storeFreePostage)
|| !NumberUtil.isNumber(storeFreePostage)
|| Integer.parseInt(storeFreePostage) == 0){
tempName = "全国包邮";
}else{
YxShippingTemplates shippingTemplates = shippingTemplatesService.getById(storeBargain.getTempId());
if(ObjectUtil.isNotNull(shippingTemplates)){
tempName = shippingTemplates.getName();
}else {
throw new BadRequestException("请配置运费模板");
}
}
this.addBargainLook(id);
YxStoreBargainQueryVo storeBargainQueryVo = generator.convert(storeBargain,
YxStoreBargainQueryVo.class);
YxStoreBargainQueryVo.class)
.setConfig(storeProductMapper.selectById(storeBargain.getProductId()).getConfig());
return BargainVo
.builder()
.bargain(storeBargainQueryVo)
.userInfo(generator.convert(yxUser, YxUserQueryVo.class))
.bargainSumCount(this.getBargainPayCount(id))
.tempName(tempName)
.build();
}
@@ -302,7 +346,8 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
* @return List
*/
@Override
public List<YxStoreBargainQueryVo> getList(int page, int limit) {
public Map<String,List<YxStoreBargainQueryVo>> getList(int page, int limit) {
Map<String,List<YxStoreBargainQueryVo>> map=new HashMap<>();
Page<YxStoreBargain> pageModel = new Page<>(page, limit);
LambdaQueryWrapper<YxStoreBargain> wrapper = new LambdaQueryWrapper<>();
Date nowTime = new Date();
@@ -313,16 +358,24 @@ public class YxStoreBargainServiceImpl extends BaseServiceImpl<YxStoreBargainMap
List<YxStoreBargainQueryVo> yxStoreBargainQueryVos = generator.convert(
yxStoreBargainMapper.selectPage(pageModel,wrapper).getRecords(),
YxStoreBargainQueryVo.class);
long uid = LocalUser.getUidByToken();
List<YxStoreBargainQueryVo> isParticipation=new ArrayList<>();
List<YxStoreBargainQueryVo> isNotParticipation=new ArrayList<>();
yxStoreBargainQueryVos.forEach(item->{
item.setPeople(storeBargainUserService.getBargainUserCount(item.getId(),
OrderInfoEnum.BARGAIN_STATUS_1.getValue()));
item.setPeople(storeBargainUserService.getBargainUserCount(item.getId(), OrderInfoEnum.BARGAIN_STATUS_1.getValue()));
item.setIsParticipation(storeBargainUserService.getUserIsParticipation(uid, item.getId()));
if (item.getIsParticipation()){
isParticipation.add(item);
}else {
isNotParticipation.add(item);
}
});
return yxStoreBargainQueryVos;
map.put("yxStoreBargainQueryVos",yxStoreBargainQueryVos);
map.put("isParticipation",isParticipation);
map.put("isNotParticipation",isNotParticipation);
return map;
}
/**
* 增加分享次数
* @param id 砍价商品id
@@ -207,6 +207,17 @@ public class YxStoreBargainUserServiceImpl extends BaseServiceImpl<YxStoreBargai
.eq(YxStoreBargainUser::getStatus,status).count();
}
@Override
public Boolean getUserIsParticipation(Long uid, Long bargainId) {
Long count=this.lambdaQuery().eq(YxStoreBargainUser::getUid,uid)
.eq(YxStoreBargainUser::getBargainId,bargainId)
.eq(YxStoreBargainUser::getStatus,1).count();
if (count>0){
return true;
}
return false;
}
//
// /**
@@ -14,6 +14,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.exception.YshopException;
import co.yixiang.app.common.bean.LocalUser;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.dozer.service.IGenerator;
@@ -29,6 +30,7 @@ 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;
@@ -43,10 +45,12 @@ 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.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;
@@ -103,6 +107,8 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
@Autowired
private YxSystemConfigService systemConfigService;
@Autowired
private StoreProductMapper storeProductMapper;
/**
@@ -131,7 +137,7 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
StoreCombinationVo storeCombinationVo = new StoreCombinationVo();
storeCombinationVo.setStoreInfo(storeCombinationQueryVo);
storeCombinationVo.setStoreInfo(storeCombinationQueryVo.setConfig(storeProductMapper.selectById(storeCombination.getProductId()).getConfig()));
//评价
storeCombinationVo.setReply(replyService
@@ -199,6 +205,28 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
return combinationQueryVo;
}
@Override
public CombinationQueryVo getCombinationList(int page, int limit) {
long uid = LocalUser.getUidByToken();
Page<YxStorePink> pageModel=new Page<>(page, limit);
LambdaQueryWrapper<YxStorePink> wrapper = new LambdaQueryWrapper<>();
//Status:1 进行中 KId:0 发起人是自己
wrapper.eq(YxStorePink::getStatus,1)
.eq(YxStorePink::getUid,uid);
// .eq(YxStorePink::getKId,0);
IPage<YxStorePink> yxStorePinkIPage = yxStorePinkMapper.selectPage(pageModel, wrapper);
List<YxStoreCombinationQueryVo> collect = yxStorePinkIPage.getRecords().stream().map(i -> {
YxStoreCombinationQueryVo yxStoreCombinationQueryVo = new YxStoreCombinationQueryVo();
YxStoreCombination yxStoreCombination=yxStoreCombinationMapper.selectById(i.getCid());
BeanUtils.copyProperties(yxStoreCombination, yxStoreCombinationQueryVo);
return yxStoreCombinationQueryVo;
}).collect(Collectors.toList());
CombinationQueryVo combinationQueryVo = new CombinationQueryVo();
combinationQueryVo.setStoreCombinationQueryVos(collect);
combinationQueryVo.setLastPage(yxStorePinkIPage.getPages());
return combinationQueryVo;
};
//=======================================//
@@ -363,7 +391,7 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
.orElse(0);
if(stock <= 0) {
throw new YshopException("库存不能低于0");
throw new YshopException("活动库存不能低于0");
}
return ProductResultDto.builder()
@@ -8,12 +8,16 @@
*/
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 co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.CouponEnum;
import co.yixiang.event.TemplateBean;
import co.yixiang.event.TemplateEvent;
import co.yixiang.event.TemplateListenEnum;
import co.yixiang.modules.activity.domain.YxStoreCouponIssue;
import co.yixiang.modules.activity.domain.YxStoreCouponIssueUser;
import co.yixiang.modules.activity.service.YxStoreCouponIssueService;
@@ -23,10 +27,15 @@ import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueDto;
import co.yixiang.modules.activity.service.dto.YxStoreCouponIssueQueryCriteria;
import co.yixiang.modules.activity.service.mapper.YxStoreCouponIssueMapper;
import co.yixiang.modules.activity.vo.YxStoreCouponIssueQueryVo;
import co.yixiang.modules.product.domain.YxStoreProduct;
import co.yixiang.modules.product.service.YxStoreProductService;
import co.yixiang.utils.FileUtil;
import co.yixiang.utils.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
@@ -34,11 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
@@ -57,8 +62,10 @@ public class YxStoreCouponIssueServiceImpl extends BaseServiceImpl<YxStoreCoupon
private final YxStoreCouponUserService storeCouponUserService;
private final YxStoreCouponIssueUserService storeCouponIssueUserService;
private final YxStoreProductService yxStoreProductService;
@Autowired
private ApplicationEventPublisher publisher;
/**
* 领取优惠券
* @param id id 优惠券id
@@ -83,6 +90,14 @@ public class YxStoreCouponIssueServiceImpl extends BaseServiceImpl<YxStoreCoupon
}
storeCouponUserService.addUserCoupon(uid,couponIssueQueryVo.getCid());
//这里调用微信订阅模板发送消息
TemplateBean templateBean = TemplateBean.builder()
.couponId(couponIssueQueryVo.getCid())
.uid(uid)
.templateType(TemplateListenEnum.TYPE_10.getValue())
.time(DateUtil.formatTime(new Date()))
.build();
publisher.publishEvent(new TemplateEvent(this, templateBean));
storeCouponIssueUserService.addUserIssue(uid,id);
@@ -111,6 +126,21 @@ public class YxStoreCouponIssueServiceImpl extends BaseServiceImpl<YxStoreCoupon
.selecCoupontList(pageModel,type,productId);
for (YxStoreCouponIssueQueryVo couponIssue : list) {
Long count = this.couponCount(couponIssue.getId(),uid);
String[] idList=couponIssue.getProductId().split(",");
List<String> needIdlist;
if (idList.length>3){
needIdlist= Arrays.asList(Arrays.copyOf(idList, 3));
}else {
needIdlist= Arrays.asList(idList);
}
List<String> imageList=new ArrayList<>();
needIdlist.forEach(id->{
YxStoreProduct yxStoreProduct=yxStoreProductService.getById(id);
if (ObjectUtil.isNotEmpty(yxStoreProduct)&& StringUtils.isNotBlank(yxStoreProduct.getImage())){
imageList.add(yxStoreProductService.getById(id).getImage());
}
});
couponIssue.setImage(imageList);
if(count > 0){
couponIssue.setIsUse(true);
}else{
@@ -85,7 +85,9 @@ public class YxStoreCouponServiceImpl extends BaseServiceImpl<YxStoreCouponMappe
map.put("兑换消耗积分值", yxStoreCoupon.getIntegral());
map.put("兑换的优惠券面值", yxStoreCoupon.getCouponPrice());
map.put("最低消费多少金额可用优惠券", yxStoreCoupon.getUseMinPrice());
map.put("优惠券有效期限(单位:天)", yxStoreCoupon.getCouponTime());
// map.put("优惠券有效期限(单位:天)", yxStoreCoupon.getCouponTime());
map.put("优惠券有效期开始时间(单位:天)", yxStoreCoupon.getUseStartTime());
map.put("优惠券有效期结束时间(单位:天)", yxStoreCoupon.getUseEndTime());
map.put("排序", yxStoreCoupon.getSort());
map.put("状态(0:关闭,1:开启)", yxStoreCoupon.getStatus());
list.add(map);
@@ -8,8 +8,10 @@
*/
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 co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
@@ -26,11 +28,15 @@ import co.yixiang.modules.activity.service.dto.YxStoreCouponUserQueryCriteria;
import co.yixiang.modules.activity.service.mapper.YxStoreCouponUserMapper;
import co.yixiang.modules.activity.vo.StoreCouponUserVo;
import co.yixiang.modules.activity.vo.YxStoreCouponUserQueryVo;
import co.yixiang.modules.cart.domain.YxStoreBrandCart;
import co.yixiang.modules.cart.service.YxStoreCartService;
import co.yixiang.modules.cart.vo.YxStoreCartQueryVo;
import co.yixiang.modules.product.domain.YxStoreProduct;
import co.yixiang.modules.product.service.YxStoreProductService;
import co.yixiang.modules.user.domain.YxUser;
import co.yixiang.modules.user.service.YxUserService;
import co.yixiang.utils.FileUtil;
import co.yixiang.utils.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -44,6 +50,9 @@ 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;
@@ -69,6 +78,8 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
private YxStoreCouponService storeCouponService;
@Autowired
private YxStoreCartService yxStoreCartService;
@Autowired
private YxStoreProductService yxStoreProductService;
/**
* 获取当前用户优惠券数量
@@ -92,11 +103,15 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
@Override
public List<StoreCouponUserVo> beUsableCouponList(Long uid,String cartIds) {
Map<String, Object> cartGroup = yxStoreCartService.getUserProductCartList(uid,
Map<String, ArrayList> cartGroup = yxStoreCartService.getUserProductCartList(uid,
cartIds, ShopConstants.ZSW_ONE_NUM);
List<YxStoreCartQueryVo> cartInfo = (List<YxStoreCartQueryVo>)cartGroup.get("valid");
List<YxStoreCartQueryVo> list = new ArrayList<>();
cartGroup.get("cartList").forEach(item-> {
YxStoreBrandCart yxStoreBrandCart = (YxStoreBrandCart) item;
list.addAll(yxStoreBrandCart.getValidProductList());
});
// List<YxStoreCartQueryVo> cartInfo = (List<YxStoreCartQueryVo>)cartGroup.get("valid");
List<YxStoreCartQueryVo> cartInfo=list;
BigDecimal sumPrice = BigDecimal.ZERO;
for (YxStoreCartQueryVo storeCart : cartInfo) {
sumPrice = NumberUtil.add(sumPrice,NumberUtil.mul(storeCart.getCartNum(),storeCart.getTruePrice()));
@@ -156,7 +171,6 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
YxStoreCouponUser couponUser = new YxStoreCouponUser();
couponUser.setId((long)id);
couponUser.setStatus(1);
couponUser.setUseTime(new Date());
yxStoreCouponUserMapper.updateById(couponUser);
}
@@ -177,6 +191,27 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
long nowTime = System.currentTimeMillis();
for (YxStoreCouponUser couponUser : storeCouponUsers) {
YxStoreCouponUserQueryVo queryVo = generator.convert(couponUser,YxStoreCouponUserQueryVo.class);
queryVo.setCname(couponUser.getCouponTitle());
String[] idList = new String[0];
YxStoreCoupon yxStoreCoupon=storeCouponService.getById(queryVo.getCid());
//防止券被删除报错
if (ObjectUtil.isNotEmpty(yxStoreCoupon)){
idList= storeCouponService.getById(queryVo.getCid()).getProductId().split(",");
}
List<String> needIdlist;
if (idList.length>3){
needIdlist= Arrays.asList(Arrays.copyOf(idList, 3));
}else {
needIdlist= Arrays.asList(idList);
}
List<String> imageList=new ArrayList<>();
needIdlist.forEach(id->{
YxStoreProduct yxStoreProduct=yxStoreProductService.getById(id);
if (ObjectUtil.isNotEmpty(yxStoreProduct)&& StringUtils.isNotBlank(yxStoreProduct.getImage())){
imageList.add(yxStoreProductService.getById(id).getImage());
}
});
queryVo.setImage(imageList);
if(couponUser.getIsFail() == 1){
queryVo.set_type(CouponEnum.USE_0.getValue());
queryVo.set_msg("已失效");
@@ -186,7 +221,7 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
}else if (couponUser.getStatus() == 2){
queryVo.set_type(CouponEnum.USE_0.getValue());
queryVo.set_msg("已过期");
}else if(couponUser.getCreateTime().getTime() > nowTime || couponUser.getEndTime().getTime() < nowTime){
}else if(couponUser.getCreateTime().getTime() > nowTime || couponUser.getUseEndTime().getTime() < nowTime){
queryVo.set_type(CouponEnum.USE_0.getValue());
queryVo.set_msg("已过期");
}else{
@@ -210,18 +245,19 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
if(storeCoupon == null) {
throw new YshopException("优惠劵不存在");
}
//现在的日期向后偏移,得到优惠券的使用截止期期
// Date now = new Date();
// Date endTime = DateUtil.offsetDay(now,storeCoupon.getCouponTime());
Date now = new Date();
Date endTime = DateUtil.offsetDay(now,storeCoupon.getCouponTime());
// DateTime endTime =new DateTime(storeCoupon.getUseEndTime());
YxStoreCouponUser storeCouponUser = YxStoreCouponUser.builder()
.cid(storeCoupon.getId())
.uid(uid)
.couponPrice(storeCoupon.getCouponPrice())
.couponTitle(storeCoupon.getTitle())
.useMinPrice(storeCoupon.getUseMinPrice())
.endTime(endTime)
.useStartTime(new DateTime(storeCoupon.getUseStartTime()))
.useEndTime(new DateTime(storeCoupon.getUseEndTime()))
.type(CouponGetEnum.GET.getValue())
.build();
@@ -260,7 +296,7 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
private void checkInvalidCoupon() {
Date nowTime = new Date();
LambdaQueryWrapper<YxStoreCouponUser> wrapper= new LambdaQueryWrapper<>();
wrapper.lt(YxStoreCouponUser::getEndTime,nowTime)
wrapper.lt(YxStoreCouponUser::getUseEndTime,nowTime)
.eq(YxStoreCouponUser::getStatus,CouponEnum.STATUS_0.getValue());
YxStoreCouponUser couponUser = new YxStoreCouponUser();
couponUser.setStatus(CouponEnum.STATUS_2.getValue());
@@ -305,8 +341,8 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
map.put("优惠券的面值", yxStoreCouponUser.getCouponPrice());
map.put("最低消费多少金额可用优惠券", yxStoreCouponUser.getUseMinPrice());
map.put("优惠券创建时间", yxStoreCouponUser.getAddTime());
map.put("优惠券结束时间", yxStoreCouponUser.getEndTime());
map.put("使用时间", yxStoreCouponUser.getUseTime());
map.put("优惠券使用结束时间", yxStoreCouponUser.getUseEndTime());
map.put("使用开始时间", yxStoreCouponUser.getUseEndTime());
map.put("获取方式", yxStoreCouponUser.getType());
map.put("状态(0:未使用,1:已使用, 2:已过期)", yxStoreCouponUser.getStatus());
map.put("是否有效", yxStoreCouponUser.getIsFail());
@@ -334,7 +370,7 @@ public class YxStoreCouponUserServiceImpl extends BaseServiceImpl<YxStoreCouponU
}else if (couponUser.getStatus() == 2){
queryVo.set_type(CouponEnum.USE_0.getValue());
queryVo.set_msg("已过期");
}else if(couponUser.getCreateTime().getTime() > nowTime || couponUser.getEndTime().getTime() < nowTime){
}else if(couponUser.getCreateTime().getTime() > nowTime || couponUser.getUseEndTime().getTime() < nowTime){
queryVo.set_type(CouponEnum.USE_0.getValue());
queryVo.set_msg("已过期");
}else{
@@ -18,6 +18,9 @@ import co.yixiang.constant.ShopConstants;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.OrderInfoEnum;
import co.yixiang.enums.PinkEnum;
import co.yixiang.event.TemplateBean;
import co.yixiang.event.TemplateEvent;
import co.yixiang.event.TemplateListenEnum;
import co.yixiang.modules.activity.domain.YxStoreCombination;
import co.yixiang.modules.activity.domain.YxStorePink;
import co.yixiang.modules.activity.service.YxStoreCombinationService;
@@ -47,6 +50,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.data.domain.Pageable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
@@ -55,6 +59,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
@@ -72,6 +77,8 @@ import java.util.stream.Collectors;
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, YxStorePink> implements YxStorePinkService {
@Autowired
private ApplicationEventPublisher publisher;
@Autowired
private IGenerator generator;
@Autowired
@@ -95,7 +102,6 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
@Autowired
private YxStoreVisitService yxStoreVisitService;
/**
* 取消拼团
* @param uid 用户id
@@ -316,6 +322,7 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
storePink.setStopTime(stopTime);
storePink.setUniqueId(storeCart.getProductAttrUnique());
if(order.getPinkId() > 0){ //其他成员入团
//如果该用户已经在团内
if(this.getIsPinkUid(order.getPinkId(),order.getUid())) {
return;
}
@@ -330,6 +337,19 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
//int count = (int)map.get("count");
if(pinkUserDto.getCount() == 0){//处理成功
this.pinkComplete(pinkUserDto.getUidAll(),pinkUserDto.getIdAll(),order.getUid(), pinkT);
//给团内每个人发送订阅消息
for(Long uid:pinkUserDto.getUidAll()){
TemplateBean templateBean = TemplateBean.builder()
.productId(pinkT.getPid())//拼团商品名
.uid(uid) //给团内每个人发消息
.result(true)
.payPrice(pinkT.getPrice())
.refundPrice(BigDecimal.valueOf(0))
.templateType(TemplateListenEnum.TYPE_13.getValue())
.time(DateUtil.formatTime(pinkT.getCreateTime()))
.build();
publisher.publishEvent(new TemplateEvent(this, templateBean));
}
}else{
this.pinkFail(pinkUserDto.getPinkAll(),pinkT,PinkEnum.PINK_BOOL_0.getValue());
}
@@ -579,6 +599,16 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
for (YxStorePink storePink : pinkAll) {
storeOrderService.orderApplyRefund("","","拼团时间超时",storePink.getOrderId(),storePink.getUid());
this.orderPinkFailAfter(pinkT.getUid(),storePink.getId());
TemplateBean templateBean = TemplateBean.builder()
.productId(pinkT.getPid())//拼团商品名
.uid(pinkT.getUid()) //给团内每个人发消息
.result(false)
.payPrice(pinkT.getPrice())
.refundPrice(pinkT.getPrice())
.templateType(TemplateListenEnum.TYPE_13.getValue())
.time(DateUtil.formatTime(pinkT.getCreateTime()))
.build();
publisher.publishEvent(new TemplateEvent(this, templateBean));
}
}
@@ -27,12 +27,14 @@ import co.yixiang.modules.activity.service.dto.YxStoreSeckillQueryCriteria;
import co.yixiang.modules.activity.service.mapper.YxStoreSeckillMapper;
import co.yixiang.modules.activity.vo.StoreSeckillVo;
import co.yixiang.modules.activity.vo.YxStoreSeckillQueryVo;
import co.yixiang.modules.product.domain.YxStoreProduct;
import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
import co.yixiang.modules.product.service.YxStoreProductAttrService;
import co.yixiang.modules.product.service.YxStoreProductReplyService;
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.mapper.StoreProductMapper;
import co.yixiang.modules.product.vo.YxStoreProductAttrQueryVo;
import co.yixiang.modules.shop.service.YxSystemConfigService;
import co.yixiang.modules.template.domain.YxShippingTemplates;
@@ -83,6 +85,8 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
@Autowired
private YxSystemConfigService systemConfigService;
@Autowired
private StoreProductMapper storeProductMapper;
/**
* 产品详情
* @param id 砍价商品id
@@ -122,7 +126,7 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
return StoreSeckillVo.builder()
.productAttr((List<YxStoreProductAttrQueryVo>)returnMap.get("productAttr"))
.productValue((Map<String, YxStoreProductAttrValue>)returnMap.get("productValue"))
.storeInfo(generator.convert(storeSeckill, YxStoreSeckillQueryVo.class))
.storeInfo(generator.convert(storeSeckill, YxStoreSeckillQueryVo.class).setConfig(storeProductMapper.selectById(storeSeckill.getProductId()).getConfig()))
.reply(replyService.getReply(storeSeckill.getProductId()))
.replyCount(replyService.productReplyCount(storeSeckill.getProductId()))
.tempName(tempName)
@@ -28,7 +28,7 @@ public interface YxStoreCouponIssueMapper extends CoreMapper<YxStoreCouponIssue>
@Select("<script>select A.cid,A.end_time as endTime,A.start_time as startTime,A.cname,A.ctype," +
"A.is_permanent as isPermanent,A.remain_count as remainCount," +
"A.total_count as totalCount,A.id,B.coupon_price as couponPrice," +
"B.use_min_price as useMinPrice" +
"B.use_min_price as useMinPrice,B.product_id as productId" +
" from yx_store_coupon_issue A left join yx_store_coupon B " +
"on A.cid = B.id " +
"where A.status =1 <if test='type == 1'> AND B.type = #{type} AND FIND_IN_SET(#{productId},product_id)</if> " +
@@ -11,6 +11,7 @@ package co.yixiang.modules.activity.service.mapper;
import co.yixiang.common.mapper.CoreMapper;
import co.yixiang.modules.activity.domain.YxStoreCouponUser;
import co.yixiang.modules.activity.vo.StoreCouponUserVo;
import io.swagger.annotations.ApiModelProperty;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
@@ -24,15 +25,21 @@ import java.util.List;
*/
@Repository
public interface YxStoreCouponUserMapper extends CoreMapper<YxStoreCouponUser> {
@Select("select A.id,A.coupon_title as couponTitle,A.coupon_price as couponPrice," +
"A.end_time as endTime,B.use_min_price as useMinPrice,B.type," +
@Select("select A.id,A.coupon_title as cname,A.coupon_price as couponPrice," +
"A.use_end_time as endTime,B.use_min_price as useMinPrice,B.type," +
"B.product_id as productId" +
" from yx_store_coupon_user A left join yx_store_coupon B " +
"on A.cid = B.id " +
"where A.status = 0" +
" AND A.end_time > #{now} " +
" AND A.use_end_time > #{now} " +
" AND A.uid = #{uid} AND A.use_min_price <= #{price} " +
" ORDER BY B.id DESC")
List<StoreCouponUserVo> selectCouponList(@Param("now") Date now, @Param("price") double price,
@Param("uid") Long uid);
@Select("select *from yx_store_coupon_user where status = 0 AND is_fail=0 AND use_end_time <= #{endTime}")
List<YxStoreCouponUser> selectUserCouponList(@Param("endTime") Date endTime);
//"状态(0:未使用,1:已使用, 2:已过期)"
}
@@ -18,4 +18,5 @@ public class BargainVo implements Serializable {
private YxStoreBargainQueryVo bargain;
private YxUserQueryVo userInfo;
private Long bargainSumCount;//砍价支付成功订单数量
private String tempName;//运费模板
}
@@ -7,6 +7,7 @@ import lombok.Setter;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 优惠券发放记录对象StoreCouponUserVO
@@ -26,7 +27,7 @@ public class StoreCouponUserVo implements Serializable
/** 优惠券名称 */
@ApiModelProperty(value = "优惠券名称")
private String couponTitle;
private String cname;
/** 优惠券的面值 */
@ApiModelProperty(value = "优惠券的面值")
@@ -49,6 +50,7 @@ public class StoreCouponUserVo implements Serializable
@ApiModelProperty(value = "优惠产品ID")
private String productId;
@ApiModelProperty(value = "商品轮播图")
private List<String> image;
}
@@ -1,5 +1,6 @@
package co.yixiang.modules.activity.vo;
import co.yixiang.modules.evaluation.domain.EditableTabs;
import co.yixiang.serializer.BigDecimalSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
@@ -8,6 +9,7 @@ import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
/**
@@ -34,6 +36,8 @@ public class YxStoreBargainQueryVo implements Serializable {
@ApiModelProperty(value = "砍价活动图片")
private String image;
//七天无理由等配置
private ArrayList<EditableTabs> config;
@ApiModelProperty(value = "单位名称")
private String unitName;
@@ -113,5 +117,6 @@ public class YxStoreBargainQueryVo implements Serializable {
@ApiModelProperty(value = "砍价产品参与人数")
private Long people;
@ApiModelProperty(value = "该用户是否已发起砍价")
private Boolean isParticipation;
}
@@ -1,6 +1,7 @@
package co.yixiang.modules.activity.vo;
import cn.hutool.core.util.StrUtil;
import co.yixiang.modules.evaluation.domain.EditableTabs;
import co.yixiang.serializer.BigDecimalSerializer;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@@ -43,6 +44,8 @@ public class YxStoreCombinationQueryVo implements Serializable {
private List<String> sliderImageArr;
//七天无理由等配置
private ArrayList<EditableTabs> config;
public List<String> getSliderImageArr() {
if(StrUtil.isNotEmpty(images)){
return Arrays.asList(images.split(","));
@@ -7,6 +7,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* <p>
@@ -32,6 +33,12 @@ public class YxStoreCouponIssueQueryVo implements Serializable {
@ApiModelProperty(value = "优惠券类别")
private Integer ctype;
@ApiModelProperty(value = "可用商品id")
private String productId;
@ApiModelProperty(value = "商品轮播图")
private List<String> image;
@ApiModelProperty(value = "优惠券领取开启时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
private Date startTime;
@@ -8,6 +8,7 @@ import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* <p>
@@ -28,11 +29,14 @@ public class YxStoreCouponUserQueryVo implements Serializable {
@ApiModelProperty(value = "兑换的项目id")
private Integer cid;
@ApiModelProperty(value = "优惠券图片")
private List<String> image;
@ApiModelProperty(value = "优惠券所属用户")
private Long uid;
@ApiModelProperty(value = "优惠券名称")
private String couponTitle;
private String cname;
@ApiModelProperty(value = "优惠券的面值")
private BigDecimal couponPrice;
@@ -44,12 +48,20 @@ public class YxStoreCouponUserQueryVo implements Serializable {
@ApiModelProperty(value = "优惠券创建时间")
private Date createTime;
@ApiModelProperty(value = "优惠券结束时间")
@ApiModelProperty(value = "优惠券有效期开始时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
private Date endTime;
private Date useStartTime;
@ApiModelProperty(value = "使用时间")
private Date useTime;
// @ApiModelProperty(value = "优惠券结束时间")
// @JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
// private Date endTime;
@ApiModelProperty(value = "优惠券有效期结束时间")
@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
private Date useEndTime;
// @ApiModelProperty(value = "使用时间")
// private Date useTime;
@ApiModelProperty(value = "获取方式")
private String type;
@@ -1,6 +1,7 @@
package co.yixiang.modules.activity.vo;
import cn.hutool.core.util.StrUtil;
import co.yixiang.modules.evaluation.domain.EditableTabs;
import co.yixiang.serializer.BigDecimalSerializer;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@@ -37,6 +38,8 @@ public class YxStoreSeckillQueryVo implements Serializable{
@ApiModelProperty(value = "推荐图")
private String image;
//七天无理由价保等
private ArrayList<EditableTabs> config;
@ApiModelProperty(value = "轮播图")
private String images;
@@ -0,0 +1,17 @@
package co.yixiang.modules.cart.domain;
import co.yixiang.modules.cart.vo.YxStoreCartQueryVo;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class YxStoreBrandCart{
//购物车品牌的信息
private Map<String, Object> brand;
//购物车品牌下的有效的商品列表
private List<YxStoreCartQueryVo> validProductList;
// //购物车品牌下的无效的商品列表
// private List<YxStoreCartQueryVo> invalidProductList;
}
@@ -17,6 +17,7 @@ import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -48,7 +49,7 @@ public interface YxStoreCartService extends BaseService<YxStoreCart>{
* @param status 0-购购物车列表
* @return map valid-有效购物车 invalid-失效购物车
*/
Map<String,Object> getUserProductCartList(Long uid,String cartIds,Integer status);
Map<String, ArrayList> getUserProductCartList(Long uid, String cartIds, Integer status);
/**
* 返回当前用户购物车总数量
@@ -23,6 +23,7 @@ import co.yixiang.modules.activity.service.YxStoreBargainService;
import co.yixiang.modules.activity.service.mapper.YxStoreBargainMapper;
import co.yixiang.modules.activity.service.mapper.YxStoreCombinationMapper;
import co.yixiang.modules.activity.service.mapper.YxStoreSeckillMapper;
import co.yixiang.modules.cart.domain.YxStoreBrandCart;
import co.yixiang.modules.cart.domain.YxStoreCart;
import co.yixiang.modules.cart.service.YxStoreCartService;
import co.yixiang.modules.cart.service.dto.YxStoreCartDto;
@@ -34,10 +35,14 @@ import co.yixiang.modules.product.domain.YxStoreProduct;
import co.yixiang.modules.product.domain.YxStoreProductAttrValue;
import co.yixiang.modules.product.service.YxStoreProductAttrService;
import co.yixiang.modules.product.service.YxStoreProductService;
import co.yixiang.modules.product.service.mapper.StoreProductMapper;
import co.yixiang.modules.product.vo.YxStoreProductQueryVo;
import co.yixiang.modules.store.domain.YxStoreBrand;
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;
@@ -48,12 +53,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@@ -65,6 +65,11 @@ import java.util.stream.Collectors;
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxStoreCart> implements YxStoreCartService {
@Autowired
private StoreProductMapper storeProductMapper;
@Autowired
private YxStoreBrandMapper yxStoreBrandMapper;
@Autowired
private IGenerator generator;
@@ -146,11 +151,11 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
*
* @param uid 用户id
* @param cartIds 购物车id,多个逗号隔开
* @param status 0-购物车列表
* @param status 0-购物车列表
* @return map valid-有效购物车 invalid-失效购物车
*/
@Override
public Map<String, Object> getUserProductCartList(Long uid, String cartIds, Integer status) {
public Map<String, ArrayList> getUserProductCartList(Long uid, String cartIds, Integer status) {
LambdaQueryWrapper<YxStoreCart> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxStoreCart::getUid, uid)
.eq(YxStoreCart::getIsPay, OrderInfoEnum.PAY_STATUS_0.getValue())
@@ -164,7 +169,7 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
List<YxStoreCart> carts = yxStoreCartMapper.selectList(wrapper);
List<YxStoreCartQueryVo> valid = new ArrayList<>();
List<YxStoreCartQueryVo> invalid = new ArrayList<>();
ArrayList<YxStoreCartQueryVo> invalid = new ArrayList<>();
for (YxStoreCart storeCart : carts) {
YxStoreProductQueryVo storeProduct = null;
@@ -197,7 +202,6 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
} else {
storeProduct.setAttrInfo(productAttrValue);
storeCartQueryVo.setProductInfo(storeProduct);
//设置真实价格
//设置VIP价格
double vipPrice = userService.setLevelPrice(
@@ -249,9 +253,37 @@ public class YxStoreCartServiceImpl extends BaseServiceImpl<StoreCartMapper, YxS
}
Map<String, Object> map = new LinkedHashMap<>();
map.put("valid", valid);
map.put("invalid", invalid);
Map<String, ArrayList> map = new LinkedHashMap<>();
//最终返回的有效商品的数组
ArrayList cartList=new ArrayList<>();
//获取不重复的品牌id数组
LinkedHashSet<String> BrandIdList = new LinkedHashSet<>();
valid.forEach(item->{
YxStoreProduct storeProduct = storeProductMapper.selectById(item.getProductId());
BrandIdList.add(storeProduct.getBrandId());
});
BrandIdList.forEach(item->{
YxStoreBrand yxStoreBrand=yxStoreBrandMapper.selectById(item);
Map<String, Object> list = new LinkedHashMap<>();
YxStoreBrandCart yxStoreBrandCart=new YxStoreBrandCart();
list.put("brandName",yxStoreBrand.getBrandName());
list.put("pic",yxStoreBrand.getPic());
yxStoreBrandCart.setBrand(list);
//对valid按品牌进行区分
List<YxStoreCartQueryVo> validProductList = new ArrayList<>();
valid.forEach(item1->{
YxStoreProduct yxStoreProduct= storeProductMapper.selectById(item1.getProductId());;
// //商品品牌id相等
if (item.equals(yxStoreProduct.getBrandId())){
validProductList.add(item1);
}
});
yxStoreBrandCart.setValidProductList(validProductList);
cartList.add(yxStoreBrandCart);
});
//将所有品牌的失效商品筛选出来
map.put("cartList",cartList);
map.put("invalidProductList",invalid);
return map;
}
@@ -11,6 +11,7 @@ package co.yixiang.modules.category.rest;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.YshopException;
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;
@@ -0,0 +1,66 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.entry.domain;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.TableName;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;
/**
* @author sj
* @date 2022-09-27
*/
@Data
@TableName("yx_store_entry")
public class YxStoreEntry implements Serializable {
/** 词条id */
@TableId
private Long id;
/** 租户id */
@NotNull
private Long tenantId;
/** 词条名称 */
@NotBlank
private String entryName;
/** 词条讲解 */
@NotBlank
private String entryInfo;
/** 添加时间 */
@TableField(fill= FieldFill.INSERT)
private Timestamp createTime;
/** 更新时间 */
@TableField(fill= FieldFill.INSERT_UPDATE)
private Timestamp updateTime;
/** 是否删除 */
private Integer isDel;
public void copy(YxStoreEntry source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}
@@ -0,0 +1,88 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.entry.rest;
import co.yixiang.domain.PageResult;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.logging.aop.log.Log;
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.domain.YxStoreEntry;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
/**
* @author ssj
* @date 2022-09-27
*/
@AllArgsConstructor
@Api(tags = " 商品词条管理")
@RestController
@RequestMapping("/api/yxStoreEntry")
public class YxStoreEntryController {
private final YxStoreEntryService yxStoreEntryService;
private final IGenerator generator;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxStoreExpert:list')")
public void download(HttpServletResponse response, YxStoreEntryQueryCriteria criteria) throws IOException {
yxStoreEntryService.download(generator.convert(yxStoreEntryService.queryAll(criteria), YxStoreEntryDto.class), response);
}
@GetMapping
@Log("查询 商品词条")
@ApiOperation("查询 商品词条")
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxStoreExpert:list')")
public ResponseEntity<PageResult<YxStoreEntryDto>> getYxStoreEntrys(YxStoreEntryQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(yxStoreEntryService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增 商品词条")
@ApiOperation("新增 商品词条")
// @PreAuthorize("ss.hasAnyPermissions('admin','yxStoreExpert:add')")
public ResponseEntity<Object> create(@Validated @RequestBody YxStoreEntry resources){
return new ResponseEntity<>(yxStoreEntryService.save(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改 商品词条")
@ApiOperation("修改 商品词条")
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxStoreExpert:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody YxStoreEntry resources){
yxStoreEntryService.updateById(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除 商品词条")
@ApiOperation("删除 商品词条")
// @PreAuthorize("@ss.hasAnyPermissions ('admin','yxStoreExpert:del')")
@DeleteMapping
public ResponseEntity<Object> deleteAll(@RequestBody Long[] ids) {
Arrays.asList(ids).forEach(id->{
yxStoreEntryService.removeById(id);
});
return new ResponseEntity<>(HttpStatus.OK);
}
}
@@ -0,0 +1,55 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.entry.service;
import co.yixiang.common.service.BaseService;
import co.yixiang.domain.PageResult;
import co.yixiang.modules.entry.domain.YxStoreEntry;
import co.yixiang.modules.entry.service.dto.YxStoreEntryDto;
import co.yixiang.modules.entry.service.dto.YxStoreEntryQueryCriteria;
import co.yixiang.modules.product.vo.ProductVo;
import co.yixiang.utils.EntryDTO;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* @author sj
* @date 2022-09-27
*/
public interface YxStoreEntryService extends BaseService<YxStoreEntry> {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
PageResult<YxStoreEntryDto> queryAll(YxStoreEntryQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<YxStoreEntryDto>
*/
List<YxStoreEntry> queryAll(YxStoreEntryQueryCriteria criteria);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<YxStoreEntryDto> all, HttpServletResponse response) throws IOException;
EntryDTO getEntry(int id);
EntryDTO getEntryByName(String name);
}
@@ -0,0 +1,42 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.entry.service.dto;
import lombok.Data;
import java.sql.Timestamp;
import java.io.Serializable;
/**
* @author sj
* @date 2022-09-27
*/
@Data
public class YxStoreEntryDto implements Serializable {
/** 词条id */
private Long id;
/** 租户id */
private Long tenantId;
/** 词条名称 */
private String entryName;
/** 词条讲解 */
private String entryInfo;
/** 添加时间 */
private Timestamp createTime;
/** 更新时间 */
private Timestamp updateTime;
/** 是否删除 */
private Integer isDel;
}
@@ -0,0 +1,19 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.entry.service.dto;
import lombok.Data;
/**
* @author sj
* @date 2022-09-27
*/
@Data
public class YxStoreEntryQueryCriteria{
}
@@ -0,0 +1,122 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.entry.service.impl;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.domain.PageResult;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.CommonEnum;
import co.yixiang.modules.entry.domain.YxStoreEntry;
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;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* @author sj
* @date 2022-09-27
*/
@Service
@AllArgsConstructor
//@CacheConfig(cacheNames = "yxStoreEntry")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxStoreEntryServiceImpl extends BaseServiceImpl<YxStoreEntryMapper, YxStoreEntry> implements YxStoreEntryService {
private final IGenerator generator;
private final YxStoreEntryMapper yxStoreEntryMapper;
@Override
//@Cacheable
public PageResult<YxStoreEntryDto> queryAll(YxStoreEntryQueryCriteria criteria, Pageable pageable) {
getPage(pageable);
PageInfo<YxStoreEntry> page = new PageInfo<>(queryAll(criteria));
return generator.convertPageInfo(page,YxStoreEntryDto.class);
}
@Override
//@Cacheable
public List<YxStoreEntry> queryAll(YxStoreEntryQueryCriteria criteria){
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreEntry.class, criteria));
}
@Override
public void download(List<YxStoreEntryDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (YxStoreEntryDto yxStoreEntry : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("租户id", yxStoreEntry.getTenantId());
map.put("词条名称", yxStoreEntry.getEntryName());
map.put("词条讲解", yxStoreEntry.getEntryInfo());
map.put("添加时间", yxStoreEntry.getCreateTime());
map.put("更新时间", yxStoreEntry.getUpdateTime());
map.put("是否删除", yxStoreEntry.getIsDel());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
@Override
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "词条ID", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
})
public EntryDTO getEntry(int id) {
LambdaQueryWrapper<YxStoreEntry> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxStoreEntry::getIsDel, CommonEnum.DEL_STATUS_0.getValue()).eq(YxStoreEntry::getId, id);
YxStoreEntry yxStoreEntry=yxStoreEntryMapper.selectOne(wrapper);
EntryDTO entryDTO=new EntryDTO();
//取出需要的属性
entryDTO.setEntryName(yxStoreEntry.getEntryName());
entryDTO.setEntryInfo(yxStoreEntry.getEntryInfo());
return entryDTO;
}
@Override
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "名字", paramType = "query", dataType = "string",dataTypeClass = String.class)
})
public EntryDTO getEntryByName(String name) {
LambdaQueryWrapper<YxStoreEntry> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxStoreEntry::getIsDel, CommonEnum.DEL_STATUS_0.getValue()).eq(YxStoreEntry::getEntryName,name);
YxStoreEntry yxStoreEntry=yxStoreEntryMapper.selectOne(wrapper);
if (yxStoreEntry==null){
throw new YshopException("没有这个词条");
}
EntryDTO entryDTO=new EntryDTO();
//取出需要的属性
entryDTO.setEntryName(yxStoreEntry.getEntryName());
entryDTO.setEntryInfo(yxStoreEntry.getEntryInfo());
return entryDTO;
}
}
@@ -0,0 +1,25 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.entry.service.mapper;
import co.yixiang.common.mapper.CoreMapper;
import co.yixiang.modules.entry.domain.YxStoreEntry;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author sj
* @date 2022-09-27
*/
@Repository
public interface YxStoreEntryMapper extends CoreMapper<YxStoreEntry> {
}
@@ -0,0 +1,22 @@
package co.yixiang.modules.evaluation.domain;
import lombok.Data;
import java.io.Serializable;
@Data
public class EditableTabs implements Serializable {
private static final long serialVersionUID = 1L;
// {title: '初始栏',
// name: '0',
// content: '产品展示栏',
// configuration:'富文本框'
//}
private String title;
private String name;
private String content;
private String configuration;
}
@@ -0,0 +1,114 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.evaluation.domain;
import co.yixiang.modules.product.domain.YxStoreProduct;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.TableName;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;
import java.util.ArrayList;
/**
* @author ssj
* @date 2022-09-21
*/
@Data
@TableName(value ="yx_evaluation", autoResultMap = true)
public class YxEvaluation implements Serializable {
/** 评测ID */
@TableId
private Integer id;
/** 在列表里面的首页图 */
private String homeImage;
/** 评测介绍 */
private String synopsis;
/** 评测视频 */
private String videoInput;
/** 关联商品信息 */
@NotNull
private String product;
/** 图文配置*/
@TableField(typeHandler = JacksonTypeHandler.class)
private ArrayList<EditableTabs> editableTabs;
/** 评测总结 */
private String summary;
/** 产品展示图集 */
private String displayImage;
/** 产品展示文字 */
private String displaySynopsis;
/** 实用体验感受图 */
private String feelImage;
/** 使用体验感受文字 */
private String feelSynopsis;
/** 易用性体验图 */
private String accessibilityImage;
/** 易用性体验文字 */
private String accessibilitySynopsis;
/** 添加时间 */
@TableField(fill= FieldFill.INSERT)
private Timestamp createTime;
/** 更新时间 */
@TableField(fill= FieldFill.INSERT_UPDATE)
private Timestamp updateTime;
/** 是否删除 */
private Integer isDel;
/** 是否展示 */
private Integer isShow;
/** 排序 */
@NotNull
private Integer sort;
private Long tenantId;
public void copy(YxEvaluation source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}
@@ -0,0 +1,40 @@
package co.yixiang.modules.evaluation.domain;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDomain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
/**
* <p>
* 评测点赞和收藏表
* </p>
*
* @author sj
* @since 2022-10-19
*/
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class YxStoreEvaluationRelation extends BaseDomain {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@ApiModelProperty(value = "用户ID")
private Long uid;
@ApiModelProperty(value = "评测ID")
private Long evaluationId;
@ApiModelProperty(value = "类型(收藏(collect)、点赞(like)、足迹(foot))")
private String type;
}
@@ -0,0 +1,90 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.evaluation.rest;
import co.yixiang.domain.PageResult;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.modules.evaluation.domain.YxEvaluation;
import co.yixiang.modules.evaluation.service.YxEvaluationService;
import co.yixiang.modules.evaluation.service.dto.YxEvaluationDto;
import co.yixiang.modules.evaluation.service.dto.YxEvaluationQueryCriteria;
import co.yixiang.modules.expert.service.dto.YxStoreExpertDto;
import co.yixiang.modules.expert.service.dto.YxStoreExpertQueryCriteria;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
/**
* @author ssj
* @date 2022-09-21
*/
@AllArgsConstructor
@Api(tags = " Evaluation管理")
@RestController
@RequestMapping("/api/yxEvaluation")
public class YxEvaluationController {
private final YxEvaluationService yxEvaluationService;
private final IGenerator generator;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxEvaluation:list')")
public void download(HttpServletResponse response, YxEvaluationQueryCriteria criteria) throws IOException {
yxEvaluationService.download(generator.convert(yxEvaluationService.queryAll(criteria), YxEvaluationDto.class), response);
}
@GetMapping
@Log("查询 评测")
@ApiOperation("查询 评测")
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxEvaluation:list')")
public ResponseEntity<PageResult<YxEvaluationDto>> getYxEvaluations(YxEvaluationQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(yxEvaluationService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增 评测")
@ApiOperation("新增 评测")
// @PreAuthorize("ss.hasAnyPermissions('admin','yxEvaluation:add')")
public ResponseEntity<Object> create(@Validated @RequestBody YxEvaluation resources){
return new ResponseEntity<>(yxEvaluationService.save(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改 评测")
@ApiOperation("修改 评测")
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxEvaluation:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody YxEvaluation resources){
yxEvaluationService.updateById(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除 专家")
@ApiOperation("删除 专家")
// @PreAuthorize("@ss.hasAnyPermissions ('admin','yxEvaluation:del')")
@DeleteMapping
public ResponseEntity<Object> deleteAll(@RequestBody Long[] ids) {
Arrays.asList(ids).forEach(id->{
yxEvaluationService.removeById(id);
});
return new ResponseEntity<>(HttpStatus.OK);
}
}
@@ -0,0 +1,69 @@
package co.yixiang.modules.evaluation.service;
import co.yixiang.common.service.BaseService;
import co.yixiang.domain.PageResult;
import co.yixiang.modules.evaluation.domain.YxStoreEvaluationRelation;
import co.yixiang.modules.evaluation.service.dto.YxStoreEvaluationRelationDto;
import co.yixiang.modules.evaluation.vo.YxStoreEvaluationRelationQueryVo;
import co.yixiang.modules.product.service.dto.YxStoreProductRelationQueryCriteria;
import org.springframework.data.domain.Pageable;
import java.util.List;
/**
* <p>
* 评测收藏表 服务类
* </p>
*
* @author hupeng
* @since 2019-10-23
*/
public interface YxEvaluationRelationService extends BaseService<YxStoreEvaluationRelation> {
/**
* 是否收藏
* @param evaluationId 评测ID
* @param uid 用户ID
* @return Boolean
*/
Boolean isEvaluationRelation(long evaluationId, long uid);
/**
*添加收藏
* @param evaluationId 评测id
* @param uid 用户id
*/
void addEvaluationRelation(long evaluationId,long uid);
/**
* 取消收藏
* @param evaluationId 评测id
* @param uid 用户id
*/
void delEvaluationRelation(long evaluationId,long uid);
/**
* 获取用户收藏列表
* @param page page
* @param limit limit
* @param uid 用户id
* @return list
*/
List<YxStoreEvaluationRelationQueryVo> userCollectEvaluation(int page, int limit, Long uid, String type);
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
PageResult<YxStoreEvaluationRelationDto> queryAll(YxStoreProductRelationQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<YxStoreProductRelationDto>
*/
List<YxStoreEvaluationRelation> queryAll(YxStoreProductRelationQueryCriteria criteria);
}
@@ -0,0 +1,65 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.evaluation.service;
import co.yixiang.common.service.BaseService;
import co.yixiang.domain.PageResult;
import co.yixiang.modules.evaluation.domain.YxEvaluation;
import co.yixiang.modules.evaluation.service.dto.YxEvaluationDto;
import co.yixiang.modules.evaluation.service.dto.YxEvaluationQueryCriteria;
import co.yixiang.modules.evaluation.vo.YxEvaluationQueryVo;
import co.yixiang.utils.EvaluationDTO;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;
/**
* @author ssj
* @date 2022-09-21
*/
public interface YxEvaluationService extends BaseService<YxEvaluation> {
/**
* 查询数据分页
* @param criteria 条件
* @param pageable 分页参数
* @return Map<String,Object>
*/
PageResult<YxEvaluationDto> queryAll(YxEvaluationQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页
* @param criteria 条件参数
* @return List<YxEvaluationDto>
*/
List<YxEvaluation> queryAll(YxEvaluationQueryCriteria criteria);
/**
* 导出数据
* @param all 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<YxEvaluationDto> all, HttpServletResponse response) throws IOException;
/***
* 后台首页获取评测列表
*/
List<EvaluationDTO> getList();
/**
* 小程序首页获取评测列表
* @return
*/
List<YxEvaluationQueryVo> getList(int page, int limit);
EvaluationDTO getEvaluationById(Long uid,int id);
}
@@ -0,0 +1,80 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.evaluation.service.dto;
import co.yixiang.modules.evaluation.domain.EditableTabs;
import co.yixiang.modules.product.domain.YxStoreProduct;
import lombok.Data;
import java.sql.Timestamp;
import java.io.Serializable;
import java.util.ArrayList;
/**
* @author hupeng
* @date 2022-09-21
*/
@Data
public class YxEvaluationDto implements Serializable {
/** 评测ID */
private Integer id;
/** 在列表里面的首页图 */
private String homeImage;
/** 评测介绍 */
private String synopsis;
/** 评测视频 */
private String videoInput;
/** 关联商品信息*/
private String product;
/** 图文配置*/
private ArrayList<EditableTabs> editableTabs;
/** 评测总结 */
private String summary;
/** 产品展示图集 */
private String displayImage;
/** 产品展示文字 */
private String displaySynopsis;
/** 实用体验感受图 */
private String feelImage;
/** 使用体验感受文字 */
private String feelSynopsis;
/** 易用性体验图 */
private String accessibilityImage;
/** 易用性体验文字 */
private String accessibilitySynopsis;
/** 添加时间 */
private Timestamp createTime;
/** 更新时间 */
private Timestamp updateTime;
/** 是否删除 */
private Integer isDel;
/** 是否展示 */
private Integer isShow;
/** 排序 */
private Integer sort;
private Long tenantId;
}
@@ -0,0 +1,19 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.evaluation.service.dto;
import lombok.Data;
/**
* @author hupeng
* @date 2022-09-21
*/
@Data
public class YxEvaluationQueryCriteria{
}
@@ -0,0 +1,41 @@
package co.yixiang.modules.evaluation.service.dto;
import co.yixiang.modules.evaluation.domain.YxEvaluation;
import co.yixiang.modules.product.domain.YxStoreProduct;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.sql.Timestamp;
@Data
public class YxStoreEvaluationRelationDto implements Serializable {
private Long id;
/** 用户ID */
private Long uid;
private String userName;
/** 评测ID */
private Long evaluationId;
private YxEvaluation evaluation;
private YxStoreProduct product;
/** 类型(收藏(collect)、点赞(like)) */
private String type;
/** 添加时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Timestamp createTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Timestamp updateTime;
private Integer isDel;
}
@@ -0,0 +1,136 @@
package co.yixiang.modules.evaluation.service.impl;
import cn.iocoder.yudao.framework.common.exception.YshopException;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.domain.PageResult;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.modules.evaluation.domain.YxStoreEvaluationRelation;
import co.yixiang.modules.evaluation.service.YxEvaluationRelationService;
import co.yixiang.modules.evaluation.service.YxEvaluationService;
import co.yixiang.modules.evaluation.service.dto.YxStoreEvaluationRelationDto;
import co.yixiang.modules.evaluation.service.mapper.YxEvaluationRelationMapper;
import co.yixiang.modules.evaluation.vo.YxStoreEvaluationRelationQueryVo;
import co.yixiang.modules.product.service.dto.YxStoreProductRelationQueryCriteria;
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;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* <p>
* 评测点赞和收藏表 服务实现类
* </p>
*
* @author sj
* @since 2022-10-19
*/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
public class YxEvaluationRelationServiceImpl extends BaseServiceImpl<YxEvaluationRelationMapper, YxStoreEvaluationRelation> implements YxEvaluationRelationService {
@Autowired
private YxEvaluationRelationMapper yxEvaluationRelationMapper;
@Autowired
private YxEvaluationService yxEvaluationService;
@Autowired
private YxUserService userService;
@Autowired
private IGenerator generator;
/**
* 是否收藏
* @param evaluationId 评测ID
* @param uid 用户ID
* @return Boolean
*/
@Override
public Boolean isEvaluationRelation(long evaluationId, long uid) {
Long count = yxEvaluationRelationMapper
.selectCount(Wrappers.<YxStoreEvaluationRelation>lambdaQuery()
.eq(YxStoreEvaluationRelation::getUid,uid)
.eq(YxStoreEvaluationRelation::getIsDel,0)
.eq(YxStoreEvaluationRelation::getEvaluationId,evaluationId));
if(count > 0) {
return true;
}
return false;
}
/**
* 添加收藏
* @param evaluationId 评测id
* @param uid 用户id
*/
@Override
public void addEvaluationRelation(long evaluationId, long uid) {
if(isEvaluationRelation(evaluationId,uid)){
throw new YshopException("已收藏");
}
YxStoreEvaluationRelation storeEvaluationRelation=YxStoreEvaluationRelation.builder()
.evaluationId(evaluationId)
.uid(uid)
.build();
yxEvaluationRelationMapper.insert(storeEvaluationRelation);
}
/**
* 取消收藏
* @param evaluationId 评测id
* @param uid 用户id
*/
@Override
public void delEvaluationRelation(long evaluationId, long uid) {
YxStoreEvaluationRelation evaluationRelation =this.lambdaQuery()
.eq(YxStoreEvaluationRelation::getEvaluationId,evaluationId)
.eq(YxStoreEvaluationRelation::getUid,uid)
.one();
if (evaluationRelation == null){
throw new YshopException("已取消");
}
this.removeById(evaluationRelation.getId());
}
/**
* 获取用户收藏列表
* @param page page
* @param limit limit
* @param uid 用户id
* @return list
*/
@Override
public List<YxStoreEvaluationRelationQueryVo> userCollectEvaluation(int page, int limit, Long uid, String type) {
Page<YxStoreEvaluationRelation> pageModel = new Page<>(page, limit);
List<YxStoreEvaluationRelationQueryVo> list = yxEvaluationRelationMapper.selectRelationList(pageModel,uid);
return list;
}
@Override
public PageResult<YxStoreEvaluationRelationDto> queryAll(YxStoreProductRelationQueryCriteria criteria, Pageable pageable) {
getPage(pageable);
PageInfo<YxStoreEvaluationRelation> page = new PageInfo<>(queryAll(criteria));
PageResult<YxStoreEvaluationRelationDto> relationDtoPageResult = generator.convertPageInfo(page, YxStoreEvaluationRelationDto.class);
relationDtoPageResult.getContent().forEach(i ->{
i.setEvaluation(yxEvaluationService.getById(i.getEvaluationId()));
i.setUserName(userService.getYxUserById(i.getUid()).getNickname());
});
return relationDtoPageResult;
}
@Override
public List<YxStoreEvaluationRelation> queryAll(YxStoreProductRelationQueryCriteria criteria) {
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreEvaluationRelation.class, criteria));
}
}
@@ -0,0 +1,187 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.evaluation.service.impl;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import co.yixiang.common.service.impl.BaseServiceImpl;
import co.yixiang.common.utils.QueryHelpPlus;
import co.yixiang.domain.PageResult;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.enums.CommonEnum;
import co.yixiang.enums.ShopCommonEnum;
import co.yixiang.exception.ErrorRequestException;
import co.yixiang.modules.entry.domain.YxStoreEntry;
import co.yixiang.modules.evaluation.domain.YxEvaluation;
import co.yixiang.modules.evaluation.service.YxEvaluationRelationService;
import co.yixiang.modules.evaluation.service.YxEvaluationService;
import co.yixiang.modules.evaluation.service.dto.YxEvaluationDto;
import co.yixiang.modules.evaluation.service.dto.YxEvaluationQueryCriteria;
import co.yixiang.modules.evaluation.service.mapper.YxEvaluationMapper;
import co.yixiang.modules.evaluation.vo.YxEvaluationQueryVo;
import co.yixiang.modules.product.domain.YxStoreProduct;
import co.yixiang.modules.product.service.YxStoreProductService;
import co.yixiang.modules.product.service.mapper.StoreProductMapper;
import co.yixiang.modules.product.vo.ProductVo;
import co.yixiang.modules.product.vo.YxStoreProductQueryVo;
import co.yixiang.utils.EntryDTO;
import co.yixiang.utils.FileUtil;
import co.yixiang.utils.EvaluationDTO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
/**
* @author sj
* @date 2022-10-21
*/
@Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
//@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class YxEvaluationServiceImpl extends BaseServiceImpl<YxEvaluationMapper, YxEvaluation> implements YxEvaluationService {
@Autowired
private IGenerator generator;
@Autowired
private YxEvaluationMapper yxEvaluationMapper;
@Autowired
private StoreProductMapper storeProductMapper;
@Autowired
private YxStoreProductService yxStoreProductService;
@Autowired
private YxEvaluationRelationService yxEvaluationRelationService;
@Override
//@Cacheable
public PageResult<YxEvaluationDto> queryAll(YxEvaluationQueryCriteria criteria, Pageable pageable) {
getPage(pageable);
PageInfo<YxEvaluation> page = new PageInfo<>(queryAll(criteria));
//根据page里面的list的商品id查询对应的商品信息,并将商品id替换为商品信息
page.getList().forEach(yxEvaluation->{
LambdaQueryWrapper<YxStoreProduct> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.eq(YxStoreProduct::getId, yxEvaluation.getProduct());
YxStoreProduct storeProduct = storeProductMapper.selectOne(wrapper);
if (ObjectUtil.isNull(storeProduct)) {
// throw new ErrorRequestException("商品不存在或已下架");
yxEvaluation.setProduct(JSONUtil.toJsonStr(new YxStoreProduct()));
}else {
yxEvaluation.setProduct(JSONUtil.toJsonStr(storeProduct));
}
});
return generator.convertPageInfo(page,YxEvaluationDto.class);
}
@Override
//@Cacheable
public List<YxEvaluation> queryAll(YxEvaluationQueryCriteria criteria){
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxEvaluation.class, criteria));
}
@Override
public void download(List<YxEvaluationDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (YxEvaluationDto yxEvaluation : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("在列表里面的首页图", yxEvaluation.getHomeImage());
map.put("评测介绍", yxEvaluation.getSynopsis());
map.put("评测视频", yxEvaluation.getVideoInput());
map.put("关联商品信息", yxEvaluation.getProduct());
map.put("评测总结", yxEvaluation.getSummary());
map.put("产品展示图集", yxEvaluation.getDisplayImage());
map.put("产品展示文字", yxEvaluation.getDisplaySynopsis());
map.put("实用体验感受图", yxEvaluation.getFeelImage());
map.put("使用体验感受文字", yxEvaluation.getFeelSynopsis());
map.put("易用性体验图", yxEvaluation.getAccessibilityImage());
map.put("易用性体验文字", yxEvaluation.getAccessibilitySynopsis());
map.put("添加时间", yxEvaluation.getCreateTime());
map.put("更新时间", yxEvaluation.getUpdateTime());
map.put("是否删除", yxEvaluation.getIsDel());
map.put("是否展示", yxEvaluation.getIsShow());
map.put("排序", yxEvaluation.getSort());
map.put(" tenantId", yxEvaluation.getTenantId());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
/**
* app获取评测列表
* @return List
*/
@Override
public List<EvaluationDTO> getList() {
LambdaQueryWrapper<YxEvaluation> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxEvaluation::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.orderByAsc(YxEvaluation::getSort);
List<EvaluationDTO> list = generator.convert(baseMapper.selectList(wrapper),EvaluationDTO.class);
list.forEach(evaluationDTO->{
LambdaQueryWrapper<YxStoreProduct> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.eq(YxStoreProduct::getId, evaluationDTO.getProduct());
YxStoreProduct yxStoreProduct = storeProductMapper.selectOne(wrapper1);
//这里需要有一个非空判断
if (ObjectUtil.isNotNull(yxStoreProduct)){
evaluationDTO.setProductInfo(yxStoreProduct);
}else{
evaluationDTO.setProductInfo(new YxStoreProduct().setStoreName("该评测商品已删除或已下架"));
}
});
return list;
}
/**
*评测列表
* @return List
*/
@Override
public List<YxEvaluationQueryVo> getList(int page,int limit){
LambdaQueryWrapper<YxEvaluation> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(YxEvaluation::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.orderByAsc(YxEvaluation::getSort);
Page<YxEvaluation> pageModel = new Page<>(page, limit);
IPage<YxEvaluation> pageList = yxEvaluationMapper.selectPage(pageModel, wrapper);
return generator.convert(pageList.getRecords(), YxEvaluationQueryVo.class);
}
/**
* app查询评测
* @param id 商品id
* @param uid 用户id
* @return List
*/
@Override
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "词条ID", paramType = "query", dataType = "int",dataTypeClass = Integer.class)
})
public EvaluationDTO getEvaluationById(Long uid,int id) {
EvaluationDTO evaluationDTO=generator.convert(this.baseMapper.selectById(id), EvaluationDTO.class);
YxStoreProduct yxStoreProduct = yxStoreProductService.getProductInfo(Long.valueOf(evaluationDTO.getProduct()));
evaluationDTO.setProductInfo(yxStoreProduct);
//是否收藏
boolean isCollect = yxEvaluationRelationService.isEvaluationRelation(id, uid);
evaluationDTO.setIsCollect(isCollect);
return evaluationDTO;
}
}
@@ -0,0 +1,22 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.evaluation.service.mapper;
import co.yixiang.common.mapper.CoreMapper;
import co.yixiang.modules.evaluation.domain.YxEvaluation;
import org.springframework.stereotype.Repository;
/**
* @author hupeng
* @date 2022-09-21
*/
@Repository
public interface YxEvaluationMapper extends CoreMapper<YxEvaluation> {
}
@@ -0,0 +1,33 @@
package co.yixiang.modules.evaluation.service.mapper;
import co.yixiang.common.mapper.CoreMapper;
import co.yixiang.modules.evaluation.domain.YxStoreEvaluationRelation;
import co.yixiang.modules.evaluation.vo.YxStoreEvaluationRelationQueryVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 评测点赞和收藏表 Mapper 接口
* </p>
*
* @author sj
* @since 2022-10-19
*/
@Repository
public interface YxEvaluationRelationMapper extends CoreMapper<YxStoreEvaluationRelation> {
@Select("select B.id evaluation_id,B.home_image as homeImage,A.id id," +
"B.is_show as isShow"+
" from yx_store_evaluation_relation A left join yx_evaluation B " +
"on A.evaluation_id = B.id where A.uid=#{uid} and A.is_del = 0 and B.is_del = 0 order by A.create_time desc")
List<YxStoreEvaluationRelationQueryVo> selectRelationList(Page page, @Param("uid") Long uid);
}
@@ -0,0 +1,28 @@
package co.yixiang.modules.evaluation.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
* 评测表 查询
* </p>
*
* @author sj
* @date 2022-10-7
*/
@Data
@ApiModel(value ="YxEvaluationQueryVo对象",description = "首页评测查询")
public class YxEvaluationQueryVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "评测id")
private Long id;
@ApiModelProperty(value = "首页图")
private String homeImage;
}
@@ -0,0 +1,37 @@
package co.yixiang.modules.evaluation.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@ApiModel(value = "YxStoreEvaluationRelationQueryVo对象", description = "评测收藏表查询参数")
public class YxStoreEvaluationRelationQueryVo {
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty(value = "用户ID")
private Long uid;
@ApiModelProperty(value = "评测ID")
private Long evaluationId;
@ApiModelProperty(value = "类型(收藏(collect")
private String type;
@ApiModelProperty(value = "添加时间")
private Date createTime;
@ApiModelProperty(value = "首页图片")
private String homeImage;
@ApiModelProperty(value = "是否显示")
private Integer isShow;
}
@@ -0,0 +1,85 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.expert.domain;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.TableName;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.io.Serializable;
/**
* @author sj
* @date 2022-09-17
*/
@Data
@TableName("yx_store_expert")
public class YxStoreExpert implements Serializable {
/** 专家id */
@TableId
private Long id;
/** 状态(0:显示,1:不显示) */
@ApiModelProperty(value = "状态(0:显示,1:隐藏)")
private Integer isShow;
/** 排序 */
@ApiModelProperty(value = "排序")
private Integer sort;
/** 专家人像大图 */
@NotBlank
private String image;
/** 专家名称 */
@NotBlank
private String expertName;
/** 专家简介 */
@NotBlank
private String expertInfo;
/** 专家的职级 */
@NotBlank
private String expertStatus;
/** 专家所属单位 */
// @NotBlank
private String expertUnit;
/** 添加时间 */
@TableField(fill= FieldFill.INSERT)
private Timestamp createTime;
/** 更新时间 */
@TableField(fill= FieldFill.INSERT_UPDATE)
private Timestamp updateTime;
/** 是否删除 */
private Integer isDel;
public void copy(YxStoreExpert source){
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
}
}
@@ -0,0 +1,88 @@
/**
* Copyright (C) 2018-2020
* All rights reserved, Designed By www.yixiang.co
* 注意:
* 本软件为www.yixiang.co开发研制,未经购买不得使用
* 购买后可获得全部源代码(禁止转卖、分享、上传到码云、github等开源平台)
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
*/
package co.yixiang.modules.expert.rest;
import co.yixiang.domain.PageResult;
import co.yixiang.dozer.service.IGenerator;
import co.yixiang.logging.aop.log.Log;
import co.yixiang.modules.expert.domain.YxStoreExpert;
import co.yixiang.modules.expert.service.YxStoreExpertService;
import co.yixiang.modules.expert.service.dto.YxStoreExpertDto;
import co.yixiang.modules.expert.service.dto.YxStoreExpertQueryCriteria;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Arrays;
/**
* @author ssj
* @date 2022-09-17
*/
@AllArgsConstructor
@Api(tags = " 专家管理")
@RestController
@RequestMapping("/api/yxStoreExpert")
public class YxStoreExpertController {
private final YxStoreExpertService yxStoreExpertService;
private final IGenerator generator;
@Log("导出数据")
@ApiOperation("导出数据")
@GetMapping(value = "/download")
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxStoreExpert:list')")
public void download(HttpServletResponse response, YxStoreExpertQueryCriteria criteria) throws IOException {
yxStoreExpertService.download(generator.convert(yxStoreExpertService.queryAll(criteria), YxStoreExpertDto.class), response);
}
@GetMapping
@Log("查询 专家")
@ApiOperation("查询 专家")
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxStoreExpert:list')")
public ResponseEntity<PageResult<YxStoreExpertDto>> getYxStoreExperts(YxStoreExpertQueryCriteria criteria, Pageable pageable){
return new ResponseEntity<>(yxStoreExpertService.queryAll(criteria,pageable),HttpStatus.OK);
}
@PostMapping
@Log("新增 专家")
@ApiOperation("新增 专家")
// @PreAuthorize("ss.hasAnyPermissions('admin','yxStoreExpert:add')")
public ResponseEntity<Object> create(@Validated @RequestBody YxStoreExpert resources){
return new ResponseEntity<>(yxStoreExpertService.save(resources),HttpStatus.CREATED);
}
@PutMapping
@Log("修改 专家")
@ApiOperation("修改 专家")
// @PreAuthorize("@ss.hasAnyPermissions('admin','yxStoreExpert:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody YxStoreExpert resources){
yxStoreExpertService.updateById(resources);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除 专家")
@ApiOperation("删除 专家")
// @PreAuthorize("@ss.hasAnyPermissions ('admin','yxStoreExpert:del')")
@DeleteMapping
public ResponseEntity<Object> deleteAll(@RequestBody Long[] ids) {
Arrays.asList(ids).forEach(id->{
yxStoreExpertService.removeById(id);
});
return new ResponseEntity<>(HttpStatus.OK);
}
}

Some files were not shown because too many files have changed in this diff Show More