Commit 84996912 authored by 万成波's avatar 万成波

积分模块

parent 78afd66a
...@@ -33,7 +33,7 @@ spring: ...@@ -33,7 +33,7 @@ spring:
# 配置网络超时时间 # 配置网络超时时间
socketTimeout: 60000 socketTimeout: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000 timeBetweenEvictionRunsMillis: 10000
# 配置一个连接在池中最小生存的时间,单位是毫秒 # 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000 minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒 # 配置一个连接在池中最大生存的时间,单位是毫秒
......
...@@ -22,12 +22,4 @@ public interface IBbsUserPointsDetailService extends IService<BbsUserPointsDetai ...@@ -22,12 +22,4 @@ public interface IBbsUserPointsDetailService extends IService<BbsUserPointsDetai
*/ */
List<BbsUserPointsDetail> getUserPointsDetail(String userName); List<BbsUserPointsDetail> getUserPointsDetail(String userName);
/**
* 添加用户积分明细
*
* @param detail 积分明细
*/
void addUsrePointsDetail(BbsUserPointsDetail detail);
} }
...@@ -38,24 +38,4 @@ public class BbsUserPointsDetailServiceImpl extends ServiceImpl<BbsUserPointsDet ...@@ -38,24 +38,4 @@ public class BbsUserPointsDetailServiceImpl extends ServiceImpl<BbsUserPointsDet
); );
} }
/**
* 添加用户积分明细
*
* @param detail 积分明细
*/
@Transactional(rollbackFor = Exception.class)
@Override
public void addUsrePointsDetail(BbsUserPointsDetail detail) {
BbsUserPointsDetail addDetail = new BbsUserPointsDetail();
addDetail.setUserName(detail.getUserName());
addDetail.setDetailName(detail.getDetailName());
addDetail.setDetailCode(detail.getDetailCode());
addDetail.setDetailPoints(detail.getDetailPoints());
addDetail.setBeforePoints(detail.getBeforePoints());
addDetail.setAfterPoints(detail.getAfterPoints());
addDetail.setDescription(detail.getDescription());
this.save(addDetail);
}
} }
...@@ -11,6 +11,7 @@ import com.tangguo.mapper.BbsUserPointsMapper; ...@@ -11,6 +11,7 @@ import com.tangguo.mapper.BbsUserPointsMapper;
import com.tangguo.service.IBbsUserPointsDetailService; import com.tangguo.service.IBbsUserPointsDetailService;
import com.tangguo.service.IBbsUserPointsService; import com.tangguo.service.IBbsUserPointsService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionManager;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -148,7 +149,7 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B ...@@ -148,7 +149,7 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
} }
// 更新用户积分 // 更新用户积分
BbsUserPoints userPoints = this.getUserPoints(userName); BbsUserPoints userPoints = this.userPointsServiceImpl.getUserPoints(userName);
Integer currentPoints = userPoints.getCurrentPoints(); Integer currentPoints = userPoints.getCurrentPoints();
int incrCurrentPoints = currentPoints + points; int incrCurrentPoints = currentPoints + points;
userPoints.setCurrentPoints(incrCurrentPoints); userPoints.setCurrentPoints(incrCurrentPoints);
...@@ -182,7 +183,7 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B ...@@ -182,7 +183,7 @@ public class BbsUserPointsServiceImpl extends ServiceImpl<BbsUserPointsMapper, B
} }
// 更新用户积分 // 更新用户积分
BbsUserPoints userPoints = this.getUserPoints(userName); BbsUserPoints userPoints = this.userPointsServiceImpl.getUserPoints(userName);
Integer currentPoints = userPoints.getCurrentPoints(); Integer currentPoints = userPoints.getCurrentPoints();
if (points > currentPoints) { if (points > currentPoints) {
throw new ServiceException("扣减用户积分失败,当前用户可用积分不足。"); throw new ServiceException("扣减用户积分失败,当前用户可用积分不足。");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment