luodangjia
2024-11-04 e755145ce3a5d14468a09b4062c84d7c13a92f0c
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TIntegralRuleController.java
@@ -5,15 +5,22 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.account.api.feignClient.AppUserCarClient;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.TAppUser;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.service.TokenService;
import com.ruoyi.other.api.domain.THtml;
import com.ruoyi.other.api.domain.TIntegralRule;
import com.ruoyi.other.api.domain.TVip;
import com.ruoyi.other.api.dto.SaveHtml;
import com.ruoyi.other.service.THtmlService;
import com.ruoyi.other.service.TIntegralRuleService;
import com.ruoyi.other.service.TVipService;
import com.ruoyi.system.api.model.LoginUserApplet;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@@ -35,6 +42,8 @@
    private THtmlService htmlService;
    @Autowired
    private TIntegralRuleService integralRuleService;
    @Autowired
    private AppUserClient appUserClient;
    /**
@@ -54,12 +63,34 @@
        point += jsonObject.getInteger("num4");
        return R.ok(point);
    }
    @Autowired
    private TokenService tokenService;
    @Autowired
    private TVipService vipService;
    @GetMapping("/getSet")
    @ApiOperation(tags = {"管理后台-积分管理","小程序-个人中心-签到"},value = "获取积分设置")
    public R<TIntegralRule> getSet() {
        TIntegralRule res = integralRuleService.getOne(new QueryWrapper<>());
        return R.ok(res);
    }
    @GetMapping("/getSet1")
    @ApiOperation(tags = {"小程序-个人中心-签到"},value = "获取积分设置")
    public R<TIntegralRule> getSet1() {
        TIntegralRule res = integralRuleService.getOne(new QueryWrapper<>());
        LoginUserApplet loginUserApplet = tokenService.getLoginUserApplet();
        res.setIsDouble(0);
        if (loginUserApplet!=null){
            TAppUser data = appUserClient.getUserById(loginUserApplet.getUserId()).getData();
            if (data.getVipEndTime()!=null && data.getVipEndTime().isAfter(LocalDateTime.now())){
                TVip byId = vipService.getById(data.getVipId());
                Integer doubleIntegration = byId.getDoubleIntegration();
                if (doubleIntegration!=null&&doubleIntegration==1){
                    res.setIsDouble(1);
                }
            }
        }
        return R.ok(res);
    }
    
    @PostMapping("/saveSet")
    @ApiOperation(tags = {"管理后台-积分管理"},value = "保存积分设置")