修复团长取消拼团不完善的问题及其拼团下单的一个小bug

This commit is contained in:
hupeng
2019-11-22 20:38:26 +08:00
parent 19c1b912f7
commit 1218de3ca1
7 changed files with 52 additions and 12 deletions

View File

@ -56,6 +56,7 @@ public class YxStoreCombinationServiceImpl extends BaseServiceImpl<YxStoreCombin
* @param combinationId * @param combinationId
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public void decStockIncSales(int num, int combinationId) { public void decStockIncSales(int num, int combinationId) {
yxStoreCombinationMapper.decStockIncSales(num,combinationId); yxStoreCombinationMapper.decStockIncSales(num,combinationId);
} }

View File

@ -95,12 +95,41 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
throw new ErrorRequestException("拼团已完成,无法取消"); throw new ErrorRequestException("拼团已完成,无法取消");
} }
//如果团长取消拼团,团队还有人,就把后面的人作为下一任团长
YxStorePink nextPinkT = pinkAll.get(0);
//先退团长的money
RefundParam param = new RefundParam(); RefundParam param = new RefundParam();
param.setUni(pinkT.getOrderId()); param.setUni(pinkT.getOrderId());
param.setText("拼团取消开团"); param.setText("拼团取消开团");
storeOrderService.orderApplyRefund(param,pinkT.getUid()); storeOrderService.orderApplyRefund(param,pinkT.getUid());
orderPinkFailAfter(pinkT.getUid(),pinkT.getId()); orderPinkFailAfter(pinkT.getUid(),pinkT.getId());
if(ObjectUtil.isNotNull(nextPinkT)){
QueryWrapper<YxStorePink> wrapperO = new QueryWrapper<>();
YxStorePink storePinkO = new YxStorePink();
storePinkO.setKId(0);
storePinkO.setStatus(1);
storePinkO.setStopTime(OrderUtil.getSecondTimestampTwo()+"");
storePinkO.setId(nextPinkT.getId());
yxStorePinkMapper.updateById(storePinkO);
//原有团长的数据变更成新团长下面
wrapperO.eq("k_id",pinkT.getId());
YxStorePink storePinkT = new YxStorePink();
storePinkT.setKId(nextPinkT.getId());
yxStorePinkMapper.update(storePinkT,wrapperO);
//update order
YxStoreOrder storeOrder = new YxStoreOrder();
storeOrder.setPinkId(nextPinkT.getId());
storeOrder.setId(nextPinkT.getId());
storeOrderService.updateById(storeOrder);
}
} }
/** /**

View File

@ -137,6 +137,8 @@ public class YxStoreOrderServiceImpl extends BaseServiceImpl<YxStoreOrderMapper,
@Autowired @Autowired
private DelayJobService delayJobService; private DelayJobService delayJobService;
@Autowired
private YxStoreCombinationService combinationService; private YxStoreCombinationService combinationService;
@Autowired @Autowired

View File

@ -5,10 +5,10 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
#driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy #driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
driver-class-name: com.p6spy.engine.spy.P6SpyDriver driver-class-name: com.p6spy.engine.spy.P6SpyDriver
url: jdbc:p6spy:mysql://106.12.82.39:3306/yxshop?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false url: jdbc:p6spy:mysql://localhost:3306/yxshop?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
#url: jdbc:log4jdbc:mysql://localhost:3306/yxshop?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false #url: jdbc:log4jdbc:mysql://localhost:3306/yxshop?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
username: root username: root
password: Admin@123 password: root
# 初始化配置 # 初始化配置
initial-size: 3 initial-size: 3
@ -47,7 +47,7 @@ spring:
database: 0 database: 0
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379
password: root password:
#连接超时时间 #连接超时时间
timeout: 5000 timeout: 5000

View File

@ -59,7 +59,7 @@ wx:
pay: pay:
appId: wxc061dee8806ff712 appId: wxc061dee8806ff712
mchId: mchId:
mchKey: mchKey: dayouqiantuhupeng8638004yixiangt
subAppId: subAppId:
subMchId: subMchId:
keyPath: keyPath:

View File

@ -1,5 +1,6 @@
package co.yixiang.redisson; package co.yixiang.redisson;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.redisson.Redisson; import org.redisson.Redisson;
@ -39,10 +40,16 @@ public class RedissonConfig extends CachingConfigurerSupport {
private String password; private String password;
@Bean @Bean
public RedissonClient getRedisson(){ public RedissonClient getRedisson() {
Config config = new Config(); Config config = new Config();
config.useSingleServer().setAddress("redis://" + host + ":" + port).setPassword(password); if (StrUtil.isNotEmpty(password)) {
config.useSingleServer().setAddress("redis://" + host + ":" + port)
.setPassword(password);
} else {
config.useSingleServer().setAddress("redis://" + host + ":" + port);
}
//config.useSingleServer().setAddress("redis://" + host + ":" + port).setPassword(password);
//添加主从配置 //添加主从配置
// config.useMasterSlaveServers().setMasterAddress("").setPassword("").addSlaveAddress(new String[]{"",""}); // config.useMasterSlaveServers().setMasterAddress("").setPassword("").addSlaveAddress(new String[]{"",""});
@ -50,16 +57,17 @@ public class RedissonConfig extends CachingConfigurerSupport {
} }
@Bean @Bean
CacheManager cacheManager(RedissonClient redissonClient){ CacheManager cacheManager(RedissonClient redissonClient) {
Map<String, CacheConfig> config = new HashMap<>(16); Map<String, CacheConfig> config = new HashMap<>(16);
// create "testMap" cache with ttl = 24 minutes and maxIdleTime = 12 minutes // create "testMap" cache with ttl = 24 minutes and maxIdleTime = 12 minutes
config.put("testMap",new CacheConfig(24*60*1000,12*60*1000)); config.put("testMap", new CacheConfig(24 * 60 * 1000, 12 * 60 * 1000));
return new RedissonSpringCacheManager(redissonClient,config); return new RedissonSpringCacheManager(redissonClient, config);
} }
/** /**
* 自定义缓存key生成策略默认将使用该策略 * 自定义缓存key生成策略默认将使用该策略
* 使用方法 @Cacheable * 使用方法 @Cacheable
*
* @return * @return
*/ */
@Bean @Bean

View File

@ -4,9 +4,9 @@ spring:
druid: druid:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://106.12.82.39:3306/yxshop?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false url: jdbc:log4jdbc:mysql://localhost:3306/yxshop?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
username: root username: root
password: Admin@123 password: root
# 初始化配置 # 初始化配置
initial-size: 3 initial-size: 3
@ -46,7 +46,7 @@ spring:
database: 0 database: 0
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379
password: root password:
#连接超时时间 #连接超时时间
timeout: 5000 timeout: 5000