liusheng
2024-07-29 0c9ec42a824aa3242fe1e1b8ce372947f2bc9a03
代码提交
已修改11个文件
171 ■■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyLibScriptCategoryController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyLibTemplateController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrLibaTarget.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/IvrLibaTargetVO.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/SvyLibTemplateReq.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetAssortServiceImpl.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/SvyLibScriptCategoryServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/IvrLibaTargetMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceTaskController.java
@@ -58,10 +58,10 @@
    public TableDataInfo list(@RequestBody ServiceTask serviceTask) {
        PageUtils.startPageByPost(serviceTask.getPageNum(), serviceTask.getPageSize());
        List<ServiceTask> list = serviceTaskService.selectServiceTaskList(serviceTask);
        List<ServiceTaskVO> ServiceTaskVOS = DtoConversionUtils.sourceToTarget(list, ServiceTaskVO.class);
        List<ServiceTaskVO> serviceTaskVOS = DtoConversionUtils.sourceToTarget(list, ServiceTaskVO.class);
        if (CollectionUtils.isNotEmpty(ServiceTaskVOS)) {
            for (ServiceTaskVO ServiceTaskVO : ServiceTaskVOS) {
        if (CollectionUtils.isNotEmpty(serviceTaskVOS)) {
            for (ServiceTaskVO ServiceTaskVO : serviceTaskVOS) {
                ServiceSubtask ServiceTaskcall = new ServiceSubtask();
                ServiceTaskcall.setTaskid(ServiceTaskVO.getTaskid());
                List<ServiceSubtask> ServiceTaskcalls = iServiceTaskCallService.selectServiceSubtaskList(ServiceTaskcall);
@@ -84,10 +84,10 @@
                }
            });
            return getDataTable2(total, ServiceTaskVOS);
            return getDataTable2(total, serviceTaskVOS);
        }
        return getDataTable2(0, ServiceTaskVOS);
        return getDataTable2(0, serviceTaskVOS);
    }
    /**
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyLibScriptCategoryController.java
@@ -38,7 +38,7 @@
    @PreAuthorize("@ss.hasPermi('smartor:category:list')")
    @PostMapping("/list")
    public TableDataInfo list(@RequestBody SvyLibScriptCategory svyLibScriptCategory) {
        startPage();
//        startPage();
        List<SvyLibScriptCategoryVO> list = svyLibScriptCategoryService.selectSvyLibScriptCategoryList(svyLibScriptCategory);
        return getDataTable(list);
    }
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/SvyLibTemplateController.java
@@ -2,17 +2,20 @@
import com.aliyun.dysmsapi20170525.models.SendSmsRequest;
import com.aliyun.teaopenapi.models.Config;
import com.github.pagehelper.ISelect;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.exception.base.BaseException;
import com.ruoyi.common.utils.PageUtils;
import com.smartor.domain.SvyLibTemplate;
import com.smartor.domain.SvyLibTemplateReq;
import com.smartor.service.ISvyLibTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -39,9 +42,23 @@
    @ApiOperation("查询问卷列表详情")
    @PostMapping("/selectSvyLibTemplatelist")
    public TableDataInfo selectSvyLibTemplatelist(@RequestBody SvyLibTemplateReq svyLibTemplateReq) {
        startPage();
        PageUtils.startPageByPost(svyLibTemplateReq.getPageNum(), svyLibTemplateReq.getPageSize());
        List<SvyLibTemplate> list = svyLibTemplateService.selectSvyLibTemplateList(svyLibTemplateReq);
        return getDataTable(list);
        if (CollectionUtils.isNotEmpty(list)) {
            //获取total
            long total = PageUtils.count(new ISelect() {
                @Override
                public void doSelect() {
                    svyLibTemplateReq.setPageNum(null);
                    svyLibTemplateReq.setPageSize(null);
                    svyLibTemplateService.selectSvyLibTemplateList(svyLibTemplateReq);
                }
            });
            return getDataTable2(total, list);
        }
        return getDataTable2(0, list);
    }
//
ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/TokenService.java
@@ -1,9 +1,12 @@
package com.ruoyi.framework.web.service;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import com.sun.org.apache.bcel.internal.generic.NEW;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@@ -27,8 +30,7 @@
 * @author ruoyi
 */
@Component
public class TokenService
{
public class TokenService {
    // 令牌自定义标识
    @Value("${token.header}")
    private String header;
@@ -55,23 +57,18 @@
     *
     * @return 用户信息
     */
    public LoginUser getLoginUser(HttpServletRequest request)
    {
    public LoginUser getLoginUser(HttpServletRequest request) {
        // 获取请求携带的令牌
        String token = getToken(request);
        if (StringUtils.isNotEmpty(token))
        {
            try
            {
        if (StringUtils.isNotEmpty(token)) {
            try {
                Claims claims = parseToken(token);
                // 解析对应的权限以及用户信息
                String uuid = (String) claims.get(Constants.LOGIN_USER_KEY);
                String userKey = getTokenKey(uuid);
                LoginUser user = redisCache.getCacheObject(userKey);
                return user;
            }
            catch (Exception e)
            {
            } catch (Exception e) {
            }
        }
        return null;
@@ -80,10 +77,8 @@
    /**
     * 设置用户身份信息
     */
    public void setLoginUser(LoginUser loginUser)
    {
        if (StringUtils.isNotNull(loginUser) && StringUtils.isNotEmpty(loginUser.getToken()))
        {
    public void setLoginUser(LoginUser loginUser) {
        if (StringUtils.isNotNull(loginUser) && StringUtils.isNotEmpty(loginUser.getToken())) {
            refreshToken(loginUser);
        }
    }
@@ -91,10 +86,8 @@
    /**
     * 删除用户身份信息
     */
    public void delLoginUser(String token)
    {
        if (StringUtils.isNotEmpty(token))
        {
    public void delLoginUser(String token) {
        if (StringUtils.isNotEmpty(token)) {
            String userKey = getTokenKey(token);
            redisCache.deleteObject(userKey);
        }
@@ -106,8 +99,7 @@
     * @param loginUser 用户信息
     * @return 令牌
     */
    public String createToken(LoginUser loginUser)
    {
    public String createToken(LoginUser loginUser) {
        String token = IdUtils.fastUUID();
        loginUser.setToken(token);
        setUserAgent(loginUser);
@@ -124,12 +116,11 @@
     * @param loginUser
     * @return 令牌
     */
    public void verifyToken(LoginUser loginUser)
    {
    public void verifyToken(LoginUser loginUser) {
        long expireTime = loginUser.getExpireTime();
        long currentTime = System.currentTimeMillis();
        if (expireTime - currentTime <= MILLIS_MINUTE_TEN)
        {
        System.out.println("令牌有效期为:" + (expireTime - currentTime)+"    "+ new Date());
        if (expireTime - currentTime <= MILLIS_MINUTE_TEN) {
            refreshToken(loginUser);
        }
    }
@@ -139,8 +130,7 @@
     *
     * @param loginUser 登录信息
     */
    public void refreshToken(LoginUser loginUser)
    {
    public void refreshToken(LoginUser loginUser) {
        loginUser.setLoginTime(System.currentTimeMillis());
        loginUser.setExpireTime(loginUser.getLoginTime() + expireTime * MILLIS_MINUTE);
        // 根据uuid将loginUser缓存
@@ -153,8 +143,7 @@
     *
     * @param loginUser 登录信息
     */
    public void setUserAgent(LoginUser loginUser)
    {
    public void setUserAgent(LoginUser loginUser) {
        UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent"));
        String ip = IpUtils.getIpAddr(ServletUtils.getRequest());
        loginUser.setIpaddr(ip);
@@ -169,11 +158,8 @@
     * @param claims 数据声明
     * @return 令牌
     */
    private String createToken(Map<String, Object> claims)
    {
        String token = Jwts.builder()
                .setClaims(claims)
                .signWith(SignatureAlgorithm.HS512, secret).compact();
    private String createToken(Map<String, Object> claims) {
        String token = Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS512, secret).compact();
        return token;
    }
@@ -183,12 +169,8 @@
     * @param token 令牌
     * @return 数据声明
     */
    private Claims parseToken(String token)
    {
        return Jwts.parser()
                .setSigningKey(secret)
                .parseClaimsJws(token)
                .getBody();
    private Claims parseToken(String token) {
        return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody();
    }
    /**
@@ -197,8 +179,7 @@
     * @param token 令牌
     * @return 用户名
     */
    public String getUsernameFromToken(String token)
    {
    public String getUsernameFromToken(String token) {
        Claims claims = parseToken(token);
        return claims.getSubject();
    }
@@ -209,18 +190,15 @@
     * @param request
     * @return token
     */
    private String getToken(HttpServletRequest request)
    {
    private String getToken(HttpServletRequest request) {
        String token = request.getHeader(header);
        if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX))
        {
        if (StringUtils.isNotEmpty(token) && token.startsWith(Constants.TOKEN_PREFIX)) {
            token = token.replace(Constants.TOKEN_PREFIX, "");
        }
        return token;
    }
    private String getTokenKey(String uuid)
    {
    private String getTokenKey(String uuid) {
        return CacheConstants.LOGIN_TOKEN_KEY + uuid;
    }
}
smartor/src/main/java/com/smartor/domain/IvrLibaTarget.java
@@ -34,7 +34,7 @@
    @Excel(name = "分组ID")
    @ApiModelProperty(value = "分组ID")
    private String groupid;
    /**
     * 适用题型(单选、多选、埴空、组合)
     */
@@ -201,5 +201,9 @@
    @Excel(name = "pageSize")
    private Integer pageSize;
    @ApiModelProperty(value = "用于查询标签的,不用于存数据")
    private String tagName;
    @ApiModelProperty(value = "用于查询标签的,不用于存数据")
    private String optionDesc;
}
smartor/src/main/java/com/smartor/domain/IvrLibaTargetVO.java
@@ -22,7 +22,7 @@
 */
@Data
@ApiModel(value = "IvrLibaTargetVO", description = "指标库对象返参")
public class IvrLibaTargetVO {
public class IvrLibaTargetVO  extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /**
@@ -223,4 +223,6 @@
    @ApiModelProperty(value = "说话内容")
    private String content;
    @ApiModelProperty(value = "用于查询标签的,不用于存数据")
    private String optionDesc;
}
smartor/src/main/java/com/smartor/domain/SvyLibTemplateReq.java
@@ -47,5 +47,16 @@
    @ApiModelProperty(value = "适用疾病")
    private String description;
    /**
     * pageNum
     */
    @ApiModelProperty("pageNum")
    private Integer pageNum;
    /**
     * pageSize
     */
    @ApiModelProperty("pageSize")
    private Integer pageSize;
}
smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetAssortServiceImpl.java
@@ -98,6 +98,8 @@
        if (seqMax != null) {
            ivrLibaTargetAssort.setSeqno(seqMax + 1);
        }
        //-1代表主树
        if (ivrLibaTargetAssort.getPid() == null) ivrLibaTargetAssort.setPid((long) -1);
        i = ivrLibaTargetAssortMapper.insertIvrLibaTargetAssort(ivrLibaTargetAssort);
        log.info("指标分类一级树的主键:{}", ivrLibaTargetAssort.getId());
smartor/src/main/java/com/smartor/service/impl/IvrLibaTargetServiceImpl.java
@@ -21,9 +21,7 @@
import org.springframework.transaction.annotation.Transactional;
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -94,10 +92,25 @@
                ivrLibaTarget1.setTargetoptionList(ivrLibaTargetoptions);
            }
            //获取该指标的标签
            IvrLibaTargetTag ivrLibaTargetTag =new IvrLibaTargetTag();
            IvrLibaTargetTag ivrLibaTargetTag = new IvrLibaTargetTag();
            ivrLibaTargetTag.setTargetid(ivrLibaTarget1.getId());
            List<IvrLibaTargetTag> ivrLibaTargetTags = ivrLibaTargetTagMapper.selectIvrLibaTargetTagList(ivrLibaTargetTag);
            ivrLibaTarget1.setIvrLibaTargetTagList(ivrLibaTargetTags);
        }
        //判断入参条件中,tagName是否有值,如果有值,则需要根据给的值进行标签过滤
        if (StringUtils.isNotEmpty(ivrLibaTarget.getTagName())) {
            List<IvrLibaTargetVO> ivrLibaTargetVOList = new ArrayList<>();
            aa:
            for (IvrLibaTargetVO ivrLibaTarget1 : ivrLibaTargetVOS) {
                for (IvrLibaTargetTag ivrLibaTargetTag1 : ivrLibaTarget1.getIvrLibaTargetTagList()) {
                    if (ivrLibaTargetTag1.getTagname().contains(ivrLibaTarget.getTagName().trim())) {
                        ivrLibaTargetVOList.add(ivrLibaTarget1);
                        continue aa;
                    }
                }
            }
            ivrLibaTargetVOS = ivrLibaTargetVOList;
        }
        //下面用左外感觉有点问题,where中的option的del会导致左边的查询不全,先不用吧
//        ivrLibaTargetMapper.targetInfo(ivrLibaTarget)
@@ -151,9 +164,12 @@
        ivrLibaTarget.setUpdateTime(DateUtils.getNowDate());
        if (ivrLibaTargetVO.getIsoperation() != null && ivrLibaTargetVO.getIsoperation() == 1) {
            //新增
            ivrLibaTarget.setCreateTime(new Date());
            ivrLibaTarget.setUpdateTime(new Date());
            ivrLibaTargetMapper.insertIvrLibaTarget(ivrLibaTarget);
        } else if (ivrLibaTargetVO.getIsoperation() != null && ivrLibaTargetVO.getIsoperation() == 2) {
            //修改
            ivrLibaTarget.setUpdateTime(new Date());
            ivrLibaTargetMapper.updateIvrLibaTarget(ivrLibaTarget);
        }
smartor/src/main/java/com/smartor/service/impl/SvyLibScriptCategoryServiceImpl.java
@@ -14,6 +14,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@@ -138,6 +139,9 @@
        if (seqMax != null) {
            svyLibScriptCategory.setSeqno(seqMax + 1);
        }
        svyLibScriptCategory.setUpdateTime(new Date());
        svyLibScriptCategory.setCreateTime(new Date());
        if (svyLibScriptCategory.getPid() == null) svyLibScriptCategory.setPid((long) -1);
        i = svyLibScriptCategoryMapper.insertSvyLibScriptCategory(svyLibScriptCategory);
        log.info("问题话术分类库一级树的主键:{}", svyLibScriptCategory.getId());
smartor/src/main/resources/mapper/smartor/IvrLibaTargetMapper.xml
@@ -33,6 +33,7 @@
        <result property="parameter" column="parameter"/>
        <result property="reply" column="reply"/>
        <result property="scriptType" column="script_type"/>
        <result property="optionDesc" column="option_desc"/>
    </resultMap>
    <resultMap type="com.smartor.domain.IvrLibaTargetVO" id="IvrLibaTargetVOResult">
@@ -60,6 +61,7 @@
        <result property="suitWay" column="suitWay"/>
        <result property="parameter" column="parameter"/>
        <result property="reply" column="reply"/>
        <result property="optionDesc" column="option_desc"/>
        <collection property="targetoptionList" javaType="java.util.List" resultMap="IvrLibaTargetoptionResult"/>
    </resultMap>
@@ -92,6 +94,7 @@
    <sql id="selectIvrLibaTargetVo">
        select id,
               groupid,
               option_desc,
               script_type,
               targettype,
               targetname,
@@ -112,7 +115,7 @@
            <if test="targetname != null  and targetname != ''">and targetname like concat('%', #{targetname}, '%')</if>
            <if test="scriptType != null  and scriptType != ''">and script_type like concat('%', #{scriptType}, '%')
            </if>
            <if test="targetdesc != null  and targetdesc != ''">and targetdesc = #{targetdesc}</if>
            <if test="targetdesc != null  and targetdesc != ''">and targetdesc like concat('%', #{targetdesc}, '%')</if>
            <if test="language != null  and language != ''">and language = #{language}</if>
            <if test="version != null ">and version = #{version}</if>
            <if test="valueType != null ">and value_type = #{valueType}</if>
@@ -129,8 +132,10 @@
            <if test="suitDisease != null and suitDisease != ''">and suitDisease = #{suitDisease}</if>
            <if test="suitWay != null and suitWay != ''">and suitWay like concat('%', #{suitWay}, '%')</if>
            <if test="parameter != null and parameter != ''">and parameter = #{parameter}</if>
            <if test="optionDesc != null and optionDesc != ''">and option_desc = #{optionDesc}</if>
        </where>
        order by update_time desc
    </select>
    <select id="targetInfo" parameterType="com.smartor.domain.IvrLibaTarget" resultMap="IvrLibaTargetVOResult">
@@ -148,6 +153,7 @@
        a.warndown,
        a.orgid,
        a.pid,
        a.option_desc,
        a.guid,
        a.reply,
        a.assortid,
@@ -187,6 +193,8 @@
            <if test="suitDisease != null and suitDisease != ''">a.suitDisease = #{suitDisease}</if>
            <if test="suitWay != null and suitWay != ''">a.suitWay like concat('%', #{suitWay}, '%')</if>
            <if test="parameter != null and parameter != ''">a.parameter = #{parameter}</if>
            <if test="optionDesc != null and optionDesc != ''">a.option_desc = #{optionDesc}</if>
        </where>
        ORDER BY a.targetID
    </select>
@@ -227,6 +235,7 @@
            <if test="parameter != null and parameter != ''">parameter,</if>
            <if test="reply != null and reply != ''">reply,</if>
            <if test="scriptType != null and scriptType != ''">script_type,</if>
            <if test="optionDesc != null and optionDesc != ''">option_desc,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="groupid != null">#{groupid},</if>
@@ -258,6 +267,7 @@
            <if test="parameter != null and parameter != ''">#{parameter},</if>
            <if test="reply != null and reply != ''">#{reply},</if>
            <if test="scriptType != null and scriptType != ''">#{scriptType},</if>
            <if test="optionDesc != null and optionDesc != ''">#{optionDesc},</if>
        </trim>
    </insert>
@@ -291,6 +301,7 @@
            <if test="parameter != null and parameter != ''">parameter = #{parameter},</if>
            <if test="reply != null and reply != ''">reply = #{reply},</if>
            <if test="scriptType != null and scriptType != ''">script_type = #{scriptType},</if>
            <if test="optionDesc != null and optionDesc != ''">option_desc = #{optionDesc},</if>
        </trim>
        where id = #{id}
    </update>