陈昶聿
6 天以前 599beddc80e7e50b2099bacdbf7df2d89df00ef2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceOutPathController.java
@@ -8,16 +8,16 @@
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.RSAPublicKeyExample;
import com.ruoyi.common.utils.ShortCode;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.BaseOrganization;
import com.smartor.service.IBaseOrganizationService;
import com.smartor.service.IPatArchiveService;
import com.ruoyi.patarchive.service.IPatArchiveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
@@ -69,16 +69,35 @@
    }
    /**
     * param就是进制
     * 外链落地页取任务信息(患者短信里的 {@code /wt?p=XXXXXX},匿名访问,不能加登录态鉴权)。
     *
     * @param param
     * @return
     * <p>短码有两种形态,都要认:
     * <ul>
     *   <li><b>6 位 base62</b>(本次改造后)—— 由 {@link ShortCode} 对主键做带密钥双射得到,
     *       不可枚举;先反解出主键再按 id 查,这样即便 {@code radix} 列被截断或没落库也能查到;</li>
     *   <li><b>3~5 位十六进制</b>(历史链接)—— 直接按 {@code radix} 列查,保证已发出的短信还能打开。</li>
     * </ul>
     *
     * @param param 短码(旧称"进制")
     * @return 任务信息;短码无效时 data 为 null
     */
    @PostMapping("/getInfoByParam")
    public AjaxResult param(@Param("param") String param) {
        ServiceOutPath serviceOutPath = new ServiceOutPath();
        serviceOutPath.setRadix(param);
        List<ServiceOutPath> list = serviceOutPathService.selectServiceOutPathList(serviceOutPath);
    public AjaxResult param(@RequestParam(value = "param", required = false) String param) {
        if (StringUtils.isEmpty(param)) {
            return success(null);
        }
        List<ServiceOutPath> list = null;
        Long id = ShortCode.decode(param);
        if (id != null) {
            ServiceOutPath byId = new ServiceOutPath();
            byId.setId(id);
            list = serviceOutPathService.selectServiceOutPathList(byId);
        }
        if (CollectionUtils.isEmpty(list)) {
            ServiceOutPath byRadix = new ServiceOutPath();
            byRadix.setRadix(param);
            list = serviceOutPathService.selectServiceOutPathList(byRadix);
        }
        if (CollectionUtils.isNotEmpty(list)) {
            ServiceOutPath serviceOutPath1 = list.get(0);
            serviceOutPath1.setId(null);
@@ -94,15 +113,14 @@
                    serviceOutPath1.setOrgname(orgname);
                }
            }
            if(StringUtils.isNotEmpty(serviceOutPath1.getParam2())){
                RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
                Long patId = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceOutPath1.getParam2(), pri_key));
                if(patId != null){
                    PatArchive patArchive = patArchiveService.selectPatArchiveByPatid(patId);
                    serviceOutPath1.setPatArchive(patArchive);
                }
            }
//            if(StringUtils.isNotEmpty(serviceOutPath1.getParam2())){
//                RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
//                Long patId = Long.valueOf(rsaPublicKeyExample.decryptedData(serviceOutPath1.getParam2(), pri_key));
//                if(patId != null){
//                    PatArchive patArchive = patArchiveService.selectPatArchiveByPatid(patId);
//                    serviceOutPath1.setPatArchive(patArchive);
//                }
//            }
            return success(serviceOutPath1);
        }
        return success(null);