|
@@ -5,13 +5,17 @@ import java.math.BigDecimal;
|
|
import java.math.BigInteger;
|
|
import java.math.BigInteger;
|
|
import java.math.MathContext;
|
|
import java.math.MathContext;
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
|
+import java.time.LocalDateTime;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.fs.common.constant.HttpStatus;
|
|
import com.fs.common.constant.HttpStatus;
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.ResponseResult;
|
|
import com.fs.common.core.domain.ResponseResult;
|
|
@@ -37,8 +41,7 @@ import com.fs.course.vo.newfs.FsCourseAnalysisCountVO;
|
|
import com.fs.course.vo.newfs.FsCourseAnalysisVO;
|
|
import com.fs.course.vo.newfs.FsCourseAnalysisVO;
|
|
import com.fs.course.vo.newfs.FsUserCourseVideoPageListVO;
|
|
import com.fs.course.vo.newfs.FsUserCourseVideoPageListVO;
|
|
import com.fs.his.config.IntegralConfig;
|
|
import com.fs.his.config.IntegralConfig;
|
|
-import com.fs.his.domain.FsUserAddress;
|
|
|
|
-import com.fs.his.domain.FsUserIntegralLogs;
|
|
|
|
|
|
+import com.fs.his.domain.*;
|
|
import com.fs.his.enums.FsUserIntegralLogTypeEnum;
|
|
import com.fs.his.enums.FsUserIntegralLogTypeEnum;
|
|
import com.fs.his.mapper.*;
|
|
import com.fs.his.mapper.*;
|
|
import com.fs.his.param.FsUserAddIntegralTemplateParam;
|
|
import com.fs.his.param.FsUserAddIntegralTemplateParam;
|
|
@@ -74,7 +77,6 @@ import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
-import com.fs.his.domain.FsUser;
|
|
|
|
import com.fs.his.service.IFsUserService;
|
|
import com.fs.his.service.IFsUserService;
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -117,7 +119,9 @@ public class FsUserServiceImpl implements IFsUserService
|
|
@Autowired
|
|
@Autowired
|
|
private CompanyTagUserMapper companyTagUserMapper;
|
|
private CompanyTagUserMapper companyTagUserMapper;
|
|
@Autowired
|
|
@Autowired
|
|
- private FsUserCompanyUserMapper fsUserCompanyUserMapper;
|
|
|
|
|
|
+ private FsPackageMapper packageMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private FsPackageSolarTermMapper packageSolarTermMapper;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private ICompanyUserCacheService companyUserCacheService;
|
|
private ICompanyUserCacheService companyUserCacheService;
|
|
@@ -287,14 +291,46 @@ public class FsUserServiceImpl implements IFsUserService
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
public void addUserIntegral(BigDecimal payMoney,Long userId,Long orderId ,Integer orderType) {
|
|
public void addUserIntegral(BigDecimal payMoney,Long userId,Long orderId ,Integer orderType) {
|
|
|
|
+ String json =configService.selectConfigByKey("his.integral");
|
|
|
|
+ IntegralConfig config = JSONUtil.toBean(json,IntegralConfig.class);
|
|
|
|
+
|
|
|
|
+ int points = payMoney.intValue() * config.getIntegralRatio();
|
|
|
|
+
|
|
|
|
+ // 节气套餐包双倍积分
|
|
|
|
+ if (isSolarTerm(orderId, orderType)) {
|
|
|
|
+ points *= 2;
|
|
|
|
+ }
|
|
|
|
+
|
|
FsUserAddIntegralTemplateParam integralTemplateParam = new FsUserAddIntegralTemplateParam();
|
|
FsUserAddIntegralTemplateParam integralTemplateParam = new FsUserAddIntegralTemplateParam();
|
|
integralTemplateParam.setUserId(userId);
|
|
integralTemplateParam.setUserId(userId);
|
|
integralTemplateParam.setLogType(FsUserIntegralLogTypeEnum.TYPE_2.getValue());
|
|
integralTemplateParam.setLogType(FsUserIntegralLogTypeEnum.TYPE_2.getValue());
|
|
integralTemplateParam.setBusinessId(orderId.toString());
|
|
integralTemplateParam.setBusinessId(orderId.toString());
|
|
- integralTemplateParam.setPoints(payMoney.intValue());
|
|
|
|
|
|
+ integralTemplateParam.setPoints(points);
|
|
userIntegralLogsService.addIntegralTemplate(integralTemplateParam);
|
|
userIntegralLogsService.addIntegralTemplate(integralTemplateParam);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 判断是否节气套餐包
|
|
|
|
+ */
|
|
|
|
+ private boolean isSolarTerm(Long orderId ,Integer orderType) {
|
|
|
|
+ if (orderType == 2) {
|
|
|
|
+ FsStoreOrder fsStoreOrder = fsStoreOrderMapper.selectFsStoreOrderByOrderId(orderId);
|
|
|
|
+ if (Objects.nonNull(fsStoreOrder.getPackageId())) {
|
|
|
|
+ FsPackage fsPackage = packageMapper.selectFsPackageByPackageId(fsStoreOrder.getPackageId());
|
|
|
|
+ if (Objects.nonNull(fsPackage) && Objects.nonNull(fsPackage.getSolarTerm())) {
|
|
|
|
+ Wrapper<FsPackageSolarTerm> queryWrapper = Wrappers.<FsPackageSolarTerm>lambdaQuery()
|
|
|
|
+ .eq(FsPackageSolarTerm::getId, fsPackage.getSolarTerm())
|
|
|
|
+ .eq(FsPackageSolarTerm::getIsDel, 0);
|
|
|
|
+ FsPackageSolarTerm fsPackageSolarTerm = packageSolarTermMapper.selectOne(queryWrapper);
|
|
|
|
+ return Objects.nonNull(fsPackageSolarTerm)
|
|
|
|
+ && LocalDateTime.now().isAfter(fsPackageSolarTerm.getStartTime())
|
|
|
|
+ && LocalDateTime.now().isBefore(fsPackageSolarTerm.getEndTime());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
public void followAddIntegral(Long userId,Long orderId) {
|
|
public void followAddIntegral(Long userId,Long orderId) {
|