9.1
liujie
4 天以前 2c2f753ed77fab235b912e09a65cfc7ce64c5131
ruoyi-service/ruoyi-management/src/main/java/com/ruoyi/management/controller/TSysSetController.java
@@ -18,6 +18,7 @@
import com.ruoyi.management.service.ITUseGuideService;
import com.ruoyi.management.vo.PageVO;
import com.ruoyi.management.vo.SysSetVO;
import com.ruoyi.study.api.feignClient.StudyClient;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -47,6 +48,8 @@
    private ITProtocolService protocolService;
    @Autowired
    private ITUseGuideService useGuideService;
    @Autowired
    private StudyClient studyClient;
    @ApiOperation(value = "获取系统设置", tags = {"后台-系统设置"})
    @PostMapping(value = "/getSysSet")
@@ -92,6 +95,7 @@
        String page2 = vo.getPage2();
        String page3 = vo.getPage3();
        String page4 = vo.getPage4();
        String page5 = vo.getPage5();
        if (StringUtils.hasLength(page1)) {
            TPage type = pageService.getOne(new QueryWrapper<TPage>()
                    .eq("type", 1));
@@ -146,18 +150,34 @@
                pageService.updateById(type);
            }
        }
        if (StringUtils.hasLength(page5)) {
            TPage type = pageService.getOne(new QueryWrapper<TPage>()
                    .eq("type", 5));
            if (type == null) {
                TPage tPage = new TPage();
                tPage.setImg(page5);
                tPage.setType(5);
                pageService.save(tPage);
            } else {
                if(!page5.equals(type.getImg())){
                    studyClient.resetLookVideo();
                }
                type.setImg(page5);
                pageService.updateById(type);
            }
        }
        return AjaxResult.success("保存成功");
    }
    @PostMapping("/agreement")
    @ApiOperation(value = "协议", tags = {"后台-协议管理"})
    public AjaxResult agreement( AggrementDTO dto) {
    public AjaxResult agreement(@RequestBody AggrementDTO dto) {
        TProtocol protocol = protocolService.getById(dto.getType());
        if (StringUtils.hasLength(dto.getContent())) {
        if (StringUtils.hasLength(dto.getContent())){
            protocol.setContent(dto.getContent());
            protocolService.updateById(protocol);
            return AjaxResult.success("修改成功");
        } else {
        }else {
            return AjaxResult.success(protocol.getContent());
        }
    }
@@ -167,9 +187,7 @@
    public R<String> agreement1(@PathVariable("type") Integer type) {
        TProtocol protocol = protocolService.getOne(new QueryWrapper<TProtocol>()
                .eq("type", type));
        return R.ok(protocol.getContent());
    }
    @PostMapping("/useGuide")
@@ -182,7 +200,6 @@
        List<String> strings = new ArrayList<>();
        strings.add("insertTime");
        wrapper.orderByDesc(strings);
        List<TUseGuide> useGuides = useGuideService.list(wrapper);
        PageInfo<TUseGuide> res = new PageInfo<>(pageNumber, pageSize);
        res.setRecords(useGuides);
@@ -204,8 +221,6 @@
        PageInfo<TUseGuide> res = new PageInfo<>(query.getPageNumber(), query.getPageSize());
        List<TUseGuide> useGuides = useGuideService.list(wrapper);
        List<TUseGuide> useGuides2 = useGuideService.listAll(query);
        PageInfo<TUseGuide> page = useGuideService.page(new PageInfo<>(query.getPageNumber(), query.getPageSize()), wrapper);
        res.setRecords(useGuides2);
        res.setTotal(useGuides.size());
@@ -258,6 +273,18 @@
    public R<TSysSet> promptVoice() {
        return R.ok(sysSetService.lambdaQuery().eq(TSysSet::getDisabled, 0).one());
    }
    @ApiOperation(value = "2.0新增,是否展示文字配置", tags = {"2.0新增,是否展示文字配置"})
    @GetMapping(value = "/getIsOpen")
    public R<Boolean> getIsOpen() {
        TSysSet one = sysSetService.lambdaQuery().eq(TSysSet::getDisabled, 0).one();
        switch (one.getIsOpen()){
            case 1:
                return R.ok(true);
            case 0:
                return R.ok(false);
        }
        return R.ok();
    }
}