xuhy
2026-01-12 1d12dfa112ca708c26b12af5909c765ab2b60254
海诊通AI对接,H5报告推送存储
3个文件已修改
100 ■■■■■ 已修改文件
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TSysAppUserController.java 47 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysBannerServiceImpl.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/utils/xiMaUtil/XimaAIUtil.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TSysAppUserController.java
@@ -4,6 +4,7 @@
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.common.constant.WxConstant;
import com.ruoyi.common.core.controller.FileController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.domain.entity.SysUser;
@@ -16,23 +17,27 @@
import com.ruoyi.system.model.TSysInspection;
import com.ruoyi.system.query.TSysAppUserQuery;
import com.ruoyi.system.service.*;
import com.ruoyi.system.utils.util.ObsUploadUtil;
import com.ruoyi.system.utils.wx.model.WeixinProperties;
import com.ruoyi.system.utils.wx.tools.WxAppletTools;
import com.ruoyi.system.utils.xiMaUtil.XimaAIUtil;
import com.ruoyi.system.vo.TSysAppUserVO;
import com.ruoyi.system.vo.TSysOrderVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.entity.ContentType;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.io.ByteArrayInputStream;
import java.util.*;
/**
 * <p>
@@ -167,7 +172,12 @@
        String userId = tokenService.getLoginUserApplet().getUserId();
        TSysAppUser sysAppUser = sysAppUserService.getById(userId);
        if(StringUtils.isBlank(sysAppUser.getNickName()) || StringUtils.isBlank(sysAppUser.getPhone()) || Objects.isNull(sysAppUser.getSex()) ||Objects.isNull(sysAppUser.getUserHeight()) || Objects.isNull(sysAppUser.getUserWeight())){
        if(StringUtils.isBlank(sysAppUser.getNickName())
                || StringUtils.isBlank(sysAppUser.getPhone())
                || Objects.isNull(sysAppUser.getSex())
                || Objects.isNull(sysAppUser.getBirthTime())
                || Objects.isNull(sysAppUser.getUserHeight())
                || Objects.isNull(sysAppUser.getUserWeight())){
            return R.fail("请先完善用户信息");
        }
@@ -176,7 +186,7 @@
            sysAppUser.setIdentifierNumber(identifierNumber);
            sysAppUserService.updateById(sysAppUser);
        }
        JSONObject authorizationH5 = ximaAIUtil.getAuthorizationH5(sysAppUser.getIdentifierNumber(), sysAppUser.getNickName(), sysAppUser.getPhone(), sysAppUser.getSex() == 1 ? "0" : "1", sysAppUser.getUserHeight(), sysAppUser.getUserWeight(), deviceType);
        JSONObject authorizationH5 = ximaAIUtil.getAuthorizationH5(sysAppUser.getIdentifierNumber(), sysAppUser.getNickName(), sysAppUser.getPhone(), sysAppUser.getSex() == 1 ? "0" : "1",sysAppUser.getBirthTime().toString(), sysAppUser.getUserHeight(), sysAppUser.getUserWeight(), deviceType);
        return R.ok(authorizationH5);
    }
@@ -196,6 +206,31 @@
        if(Objects.isNull(crmClinic)){
            return R.fail("未找到该诊所信息");
        }
        if(StringUtils.isBlank(crmClinic.getQrCode())){
            WxAppletTools wxAppletTools = new WxAppletTools(restTemplate, wxConfig, redisCache);
            // 获取access_token
            String accessToken = wxAppletTools.getAccessToken();
            // 替换CREATE_CODE_URL
            String url = WxConstant.CREATE_CODE_URL.replace("ACCESS_TOKEN", accessToken);
            // 发送请求
            try {
                HashMap<String, String> map = new HashMap<>();
                map.put("path", "");
                map.put("scene", "clinicId=" + crmClinic.getId());
                HttpHeaders headers = new HttpHeaders();
                headers.setContentType(MediaType.APPLICATION_JSON);
                HttpEntity requestEntity = new HttpEntity(map, headers);
                ResponseEntity<byte[]> rep = restTemplate.exchange(url, HttpMethod.POST, requestEntity, byte[].class);
                byte[] bytes = rep.getBody();
                ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
                MultipartFile file = new MockMultipartFile(ContentType.APPLICATION_OCTET_STREAM.toString(), byteArrayInputStream);
                String stringApiResult = ObsUploadUtil.obsUpload(file);
                crmClinic.setQrCode(stringApiResult);
            } catch (Exception e) {
                log.error("生成小程序码失败:{}", e.getMessage());
            }
            crmClinicService.updateById(crmClinic);
        }
        return R.ok(crmClinic.getQrCode());
    }
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TSysBannerServiceImpl.java
@@ -56,30 +56,32 @@
            return pageInfo;
        }
        for (TSysBannerVO sysBannerVO : list) {
            switch (sysBannerVO.getJumpType()){
                case 2:
                    TSysEducationalInfo educationalInfo = sysEducationalInfoMapper.selectById(sysBannerVO.getContentId());
                    if(Objects.nonNull(educationalInfo)){
                        sysBannerVO.setContentName(educationalInfo.getInfoTitle());
                    }
                    break;
                case 3:
                    TSysLive sysLive = sysLiveMapper.selectById(sysBannerVO.getContentId());
                    if(Objects.nonNull(sysLive)){
                        sysBannerVO.setContentName(sysLive.getLiveTitle());
                    }
                    break;
                case 4:
                    TSysProductIntroduction sysProductIntroduction = sysProductIntroductionMapper.selectById(sysBannerVO.getContentId());
                    if(Objects.nonNull(sysProductIntroduction)){
                        sysBannerVO.setContentName(sysProductIntroduction.getProductName());
                    }
                    break;
                case 5:
                    TSysActivity sysActivity = sysActivityMapper.selectById(sysBannerVO.getContentId());
                    if(Objects.nonNull(sysActivity)){
                        sysBannerVO.setContentName(sysActivity.getActivityName());
                    }
            if(Objects.nonNull(sysBannerVO.getJumpType())){
                switch (sysBannerVO.getJumpType()){
                    case 2:
                        TSysEducationalInfo educationalInfo = sysEducationalInfoMapper.selectById(sysBannerVO.getContentId());
                        if(Objects.nonNull(educationalInfo)){
                            sysBannerVO.setContentName(educationalInfo.getInfoTitle());
                        }
                        break;
                    case 3:
                        TSysLive sysLive = sysLiveMapper.selectById(sysBannerVO.getContentId());
                        if(Objects.nonNull(sysLive)){
                            sysBannerVO.setContentName(sysLive.getLiveTitle());
                        }
                        break;
                    case 4:
                        TSysProductIntroduction sysProductIntroduction = sysProductIntroductionMapper.selectById(sysBannerVO.getContentId());
                        if(Objects.nonNull(sysProductIntroduction)){
                            sysBannerVO.setContentName(sysProductIntroduction.getProductName());
                        }
                        break;
                    case 5:
                        TSysActivity sysActivity = sysActivityMapper.selectById(sysBannerVO.getContentId());
                        if(Objects.nonNull(sysActivity)){
                            sysBannerVO.setContentName(sysActivity.getActivityName());
                        }
                }
            }
        }
        pageInfo.setRecords(list);
ruoyi-system/src/main/java/com/ruoyi/system/utils/xiMaUtil/XimaAIUtil.java
@@ -34,7 +34,7 @@
     * @param device_type 设备类型:android ios
     * @return
     */
    public JSONObject getAuthorizationH5(String out_user_id,String nickname,String phone,String sex,Integer height,Integer weight,String device_type) {
    public JSONObject getAuthorizationH5(String out_user_id,String nickname,String phone,String sex,String birthday,Integer height,Integer weight,String device_type) {
        TSysAiConfig sysAiConfig = sysAiConfigService.getById(1);
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("client_id", sysAiConfig.getClientId());
@@ -42,6 +42,7 @@
        jsonObject.put("out_user_id", out_user_id);
        jsonObject.put("nickname", nickname);
        jsonObject.put("phone", phone);
        jsonObject.put("birthday", birthday);
        jsonObject.put("sex", sex);
        jsonObject.put("height", height);
        jsonObject.put("weight", weight);