This commit is contained in:
gzlv
2021-07-13 19:03:21 +08:00
parent 3261b76127
commit 538abaa5d5
9 changed files with 122 additions and 124 deletions

View File

@ -1,19 +1,15 @@
/** /**
* Copyright (C) 2018-2021 * Copyright (C) 2018-2021
* All rights reserved, Designed By www.yixiang.co * All rights reserved, Designed By www.yixiang.co
*/ */
package co.yixiang.modules.security.service; package co.yixiang.modules.security.service;
import cn.hutool.core.util.StrUtil;
import co.yixiang.constant.ShopConstants; import co.yixiang.constant.ShopConstants;
import co.yixiang.modules.security.config.SecurityProperties; import co.yixiang.modules.security.config.SecurityProperties;
import co.yixiang.modules.security.security.vo.JwtUser; import co.yixiang.modules.security.security.vo.JwtUser;
import co.yixiang.modules.user.vo.OnlineUser; import co.yixiang.modules.user.vo.OnlineUser;
import co.yixiang.utils.EncryptUtils; import co.yixiang.utils.*;
import co.yixiang.utils.FileUtil;
import co.yixiang.utils.PageUtil;
import co.yixiang.utils.RedisUtils;
import co.yixiang.utils.StringUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -21,12 +17,7 @@ import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.*;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/** /**
* @author hupeng * @author hupeng
@ -125,8 +116,8 @@ public class OnlineUserService {
* @throws Exception / * @throws Exception /
*/ */
public void kickOutT(String key) throws Exception { public void kickOutT(String key) throws Exception {
String[] split = StrUtil.split(key, ":");
String keyt = ShopConstants.YSHOP_APP_LOGIN_USER + EncryptUtils.desDecrypt(key); String keyt = ShopConstants.YSHOP_APP_LOGIN_USER + split[0] + ":" + EncryptUtils.desDecrypt(split[1]);
redisUtils.del(keyt); redisUtils.del(keyt);
} }

View File

@ -20,15 +20,18 @@ import co.yixiang.constant.ShopConstants;
import co.yixiang.enums.AppFromEnum; import co.yixiang.enums.AppFromEnum;
import co.yixiang.modules.auth.param.LoginParam; import co.yixiang.modules.auth.param.LoginParam;
import co.yixiang.modules.auth.param.RegParam; import co.yixiang.modules.auth.param.RegParam;
import co.yixiang.modules.mp.config.WxMaConfiguration;
import co.yixiang.modules.mp.config.WxMpConfiguration;
import co.yixiang.modules.shop.domain.YxSystemAttachment; import co.yixiang.modules.shop.domain.YxSystemAttachment;
import co.yixiang.modules.shop.service.YxSystemAttachmentService; import co.yixiang.modules.shop.service.YxSystemAttachmentService;
import co.yixiang.modules.user.domain.YxUser; import co.yixiang.modules.user.domain.YxUser;
import co.yixiang.modules.user.service.YxUserService; import co.yixiang.modules.user.service.YxUserService;
import co.yixiang.modules.user.service.dto.WechatUserDto; import co.yixiang.modules.user.service.dto.WechatUserDto;
import co.yixiang.modules.user.vo.OnlineUser; import co.yixiang.modules.user.vo.OnlineUser;
import co.yixiang.modules.mp.config.WxMpConfiguration; import co.yixiang.utils.EncryptUtils;
import co.yixiang.modules.mp.config.WxMaConfiguration; import co.yixiang.utils.RedisUtils;
import co.yixiang.utils.*; import co.yixiang.utils.ShopKeyUtils;
import co.yixiang.utils.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -69,10 +72,9 @@ public class AuthService {
} }
/** /**
* 小程序登陆 * 小程序登陆
*
* @param loginParam loginParam * @param loginParam loginParam
* @return long * @return long
*/ */
@ -161,6 +163,7 @@ public class AuthService {
/** /**
* 公众号登陆 * 公众号登陆
*
* @param code code码 * @param code code码
* @param spread 上级用户 * @param spread 上级用户
* @return uid * @return uid
@ -250,6 +253,7 @@ public class AuthService {
/** /**
* 注册 * 注册
*
* @param param RegDTO * @param param RegDTO
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -284,6 +288,7 @@ public class AuthService {
/** /**
* 保存在线用户信息 * 保存在线用户信息
*
* @param yxUser / * @param yxUser /
* @param token / * @param token /
* @param request / * @param request /
@ -339,6 +344,7 @@ public class AuthService {
/** /**
* 退出登录 * 退出登录
*
* @param token / * @param token /
*/ */
public void logout(String userName, String token) { public void logout(String userName, String token) {
@ -367,5 +373,4 @@ public class AuthService {
} }
} }

View File

@ -30,6 +30,7 @@ public interface YxStoreSeckillService extends BaseService<YxStoreSeckill>{
/** /**
* 产品详情 * 产品详情
*
* @param id 秒杀商品id * @param id 秒杀商品id
* @return StoreSeckillVo * @return StoreSeckillVo
*/ */
@ -37,6 +38,7 @@ public interface YxStoreSeckillService extends BaseService<YxStoreSeckill>{
/** /**
* 秒杀产品列表 * 秒杀产品列表
*
* @param page page * @param page page
* @param limit limit * @param limit limit
* @return list * @return list
@ -45,6 +47,7 @@ public interface YxStoreSeckillService extends BaseService<YxStoreSeckill>{
/** /**
* 秒杀产品列表(首页用) * 秒杀产品列表(首页用)
*
* @param page page * @param page page
* @param limit limit * @param limit limit
* @return list * @return list
@ -53,6 +56,7 @@ public interface YxStoreSeckillService extends BaseService<YxStoreSeckill>{
/** /**
* 查询数据分页 * 查询数据分页
*
* @param criteria 条件 * @param criteria 条件
* @param pageable 分页参数 * @param pageable 分页参数
* @return Map<String, Object> * @return Map<String, Object>
@ -61,6 +65,7 @@ public interface YxStoreSeckillService extends BaseService<YxStoreSeckill>{
/** /**
* 查询所有数据不分页 * 查询所有数据不分页
*
* @param criteria 条件参数 * @param criteria 条件参数
* @return List<YxStoreSeckillDto> * @return List<YxStoreSeckillDto>
*/ */
@ -68,6 +73,7 @@ public interface YxStoreSeckillService extends BaseService<YxStoreSeckill>{
/** /**
* 导出数据 * 导出数据
*
* @param all 待导出的数据 * @param all 待导出的数据
* @param response / * @param response /
* @throws IOException / * @throws IOException /

View File

@ -79,16 +79,6 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
@Autowired @Autowired
private YxShippingTemplatesService shippingTemplatesService; private YxShippingTemplatesService shippingTemplatesService;
// @Override
// public YxStoreSeckill getSeckill(int id) {
// LambdaQueryWrapper<YxStoreSeckill> wrapper = new LambdaQueryWrapper<>();
// int nowTime = OrderUtil.getSecondTimestampTwo();
// wrapper.eq("id",id).eq("is_del",0).eq("status",1)
// .le("start_time",nowTime).ge("stop_time",nowTime);
// return yxStoreSeckillMapper.selectOne(wrapper);
// }
/** /**
* 产品详情 * 产品详情
* @param id 砍价商品id * @param id 砍价商品id
@ -114,7 +104,7 @@ public class YxStoreSeckillServiceImpl extends BaseServiceImpl<YxStoreSeckillMap
String tempName = ""; String tempName = "";
if(StrUtil.isBlank(storeFreePostage) if(StrUtil.isBlank(storeFreePostage)
|| !NumberUtil.isNumber(storeFreePostage) || !NumberUtil.isNumber(storeFreePostage)
|| Integer.valueOf(storeFreePostage) == 0){ || Integer.parseInt(storeFreePostage) == 0){
tempName = "全国包邮"; tempName = "全国包邮";
}else{ }else{
YxShippingTemplates shippingTemplates = shippingTemplatesService.getById(storeSeckill.getTempId()); YxShippingTemplates shippingTemplates = shippingTemplatesService.getById(storeSeckill.getTempId());

View File

@ -46,5 +46,5 @@ public interface YxStoreProductRuleService extends BaseService<YxStoreProductRu
* @param response / * @param response /
* @throws IOException / * @throws IOException /
*/ */
void download(List<YxStoreProductRuleDto> all, HttpServletResponse response) throws IOException; void download(List<YxStoreProductRule> all, HttpServletResponse response) throws IOException;
} }

View File

@ -88,6 +88,10 @@ public class YxStoreProductAttrServiceImpl extends BaseServiceImpl<StoreProductA
attrGroup.add(yxStoreProductAttr); attrGroup.add(yxStoreProductAttr);
} }
/*int count = storeProductAttrValueService.count(Wrappers.<YxStoreProductAttrValue>lambdaQuery().eq(YxStoreProductAttrValue::getProductId, productId));
if (count > 0 ) {
throw new BadRequestException("该产品已被添加到其他活动,禁止操作!");
}*/
List<YxStoreProductAttrValue> valueGroup = new ArrayList<>(); List<YxStoreProductAttrValue> valueGroup = new ArrayList<>();
for (ProductFormatDto productFormatDto : attrs) { for (ProductFormatDto productFormatDto : attrs) {

View File

@ -64,9 +64,9 @@ public class YxStoreProductRuleServiceImpl extends BaseServiceImpl<YxStoreProduc
@Override @Override
public void download(List<YxStoreProductRuleDto> all, HttpServletResponse response) throws IOException { public void download(List<YxStoreProductRule> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
for (YxStoreProductRuleDto yxStoreProductRule : all) { for (YxStoreProductRule yxStoreProductRule : all) {
Map<String,Object> map = new LinkedHashMap<>(); Map<String,Object> map = new LinkedHashMap<>();
map.put("规格名称", yxStoreProductRule.getRuleName()); map.put("规格名称", yxStoreProductRule.getRuleName());
map.put("规格值", yxStoreProductRule.getRuleValue()); map.put("规格值", yxStoreProductRule.getRuleValue());

View File

@ -1,7 +1,6 @@
/** /**
* Copyright (C) 2018-2021 * Copyright (C) 2018-2021
* All rights reserved, Designed By www.yixiang.co * All rights reserved, Designed By www.yixiang.co
*/ */
package co.yixiang.modules.activity.rest; package co.yixiang.modules.activity.rest;
@ -57,6 +56,7 @@ public class StoreSeckillController {
private final YxStoreProductRuleService yxStoreProductRuleService; private final YxStoreProductRuleService yxStoreProductRuleService;
private final YxStoreProductAttrValueService storeProductAttrValueService; private final YxStoreProductAttrValueService storeProductAttrValueService;
private final YxStoreProductAttrResultService yxStoreProductAttrResultService; private final YxStoreProductAttrResultService yxStoreProductAttrResultService;
public StoreSeckillController(IGenerator generator, YxStoreSeckillService yxStoreSeckillService, YxShippingTemplatesService yxShippingTemplatesService, public StoreSeckillController(IGenerator generator, YxStoreSeckillService yxStoreSeckillService, YxShippingTemplatesService yxShippingTemplatesService,
YxStoreProductRuleService yxStoreProductRuleService, YxStoreProductAttrValueService storeProductAttrValueService, YxStoreProductRuleService yxStoreProductRuleService, YxStoreProductAttrValueService storeProductAttrValueService,
YxStoreProductAttrResultService yxStoreProductAttrResultService) { YxStoreProductAttrResultService yxStoreProductAttrResultService) {
@ -90,6 +90,7 @@ public class StoreSeckillController {
return new ResponseEntity(HttpStatus.NO_CONTENT); return new ResponseEntity(HttpStatus.NO_CONTENT);
} }
} }
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true) @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true)
@ForbidSubmit @ForbidSubmit
@Log("删除") @Log("删除")
@ -100,6 +101,7 @@ public class StoreSeckillController {
yxStoreSeckillService.removeById(id); yxStoreSeckillService.removeById(id);
return new ResponseEntity(HttpStatus.OK); return new ResponseEntity(HttpStatus.OK);
} }
@CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true) @CacheEvict(cacheNames = ShopConstants.YSHOP_REDIS_INDEX_KEY, allEntries = true)
@Log("新增秒杀") @Log("新增秒杀")
@ApiOperation(value = "新增秒杀") @ApiOperation(value = "新增秒杀")

View File

@ -55,7 +55,7 @@ public class StoreProductRuleController {
@GetMapping(value = "/download") @GetMapping(value = "/download")
@PreAuthorize("@el.check('admin','yxStoreProductRule:list')") @PreAuthorize("@el.check('admin','yxStoreProductRule:list')")
public void download(HttpServletResponse response, YxStoreProductRuleQueryCriteria criteria) throws IOException { public void download(HttpServletResponse response, YxStoreProductRuleQueryCriteria criteria) throws IOException {
yxStoreProductRuleService.download(generator.convert(yxStoreProductRuleService.queryAll(criteria), YxStoreProductRuleDto.class), response); yxStoreProductRuleService.download(yxStoreProductRuleService.queryAll(criteria) , response);
} }
@GetMapping @GetMapping