@@ -86,7 +86,7 @@ public class WxUserGrantController extends BaseController { | |||||
WxMallService mallService; | WxMallService mallService; | ||||
@Autowired | @Autowired | ||||
WxCLiveUserBasicInfoService wxCLiveUserBasicInfoService; | |||||
private WxCLiveUserBasicInfoService wxCLiveUserBasicInfoService; | |||||
@Autowired | @Autowired | ||||
@@ -103,6 +103,9 @@ public class WxUserGrantController extends BaseController { | |||||
@Autowired | @Autowired | ||||
private UserConsumptionPackageService userConsumptionPackageService; | private UserConsumptionPackageService userConsumptionPackageService; | ||||
@Autowired | |||||
private WxCUserAuthorityService wxCUserAuthorityService; | |||||
@AuthIgnore | @AuthIgnore | ||||
@ApiOperation("验证码") | @ApiOperation("验证码") | ||||
@@ -370,10 +373,34 @@ public class WxUserGrantController extends BaseController { | |||||
} | } | ||||
/** | /** | ||||
* 需要效验用户及图片验证码 | |||||
* @param phone | |||||
* @return | |||||
* 资源权限查询 | |||||
* | |||||
*/ | */ | ||||
@AuthIgnore | |||||
@ApiOperation(value = "资源权限查询", notes = "{\"username\",\"string\",\"code\",\"string\",\"type\",\"int\",\"resource_id\",\"long\"}") | |||||
@PostMapping("/author") | |||||
public ResultData getAuthor(@RequestBody Map<String, String> params, HttpServletResponse response) { | |||||
String ipaddress = getIpAddr(); | |||||
logger.debug("[" + ipaddress + "] WxUserGrantController::getAuthor"); | |||||
String username = params.get("username"); | |||||
String code = params.get("code"); | |||||
Integer type = Integer.parseInt(params.get("type")); | |||||
Long resourceId = Long.valueOf(params.get("resource_id")); | |||||
return wxCUserAuthorityService.getAuthor(username,code,type,resourceId); | |||||
} | |||||
/** | |||||
* 需要效验用户及图片验证码 | |||||
* @param phone | |||||
* @return | |||||
*/ | |||||
@AuthIgnore | @AuthIgnore | ||||
@ApiOperation("发送修改密码验证码") | @ApiOperation("发送修改密码验证码") | ||||
@GetMapping("sendPhoneCode") | @GetMapping("sendPhoneCode") | ||||
@@ -13,33 +13,16 @@ public class WxCUserAuthority { | |||||
@TableField(exist = false) | @TableField(exist = false) | ||||
private String userName; | private String userName; | ||||
@TableField(exist = false) //数字人 0 声纹 1 | |||||
private String type; | |||||
@TableField(exist = false) | |||||
private String resourceId; | |||||
@TableField(exist = false) //共享 0 定制 1 | |||||
private String classType; | |||||
@TableField(exist = false) | @TableField(exist = false) | ||||
private String currentTime; | private String currentTime; | ||||
@TableField(exist = false) | @TableField(exist = false) | ||||
private String expireTime; | private String expireTime; | ||||
@io.swagger.annotations.ApiModelProperty(value = "地区名称", name = "local_name") | |||||
private String localelName; | |||||
@io.swagger.annotations.ApiModelProperty(value = "地区显示名称", name = "local_display_name") | |||||
private String localDisPlayName; | |||||
@io.swagger.annotations.ApiModelProperty(value = "声纹ID", name = "voice_id") | |||||
private int voiceId; | |||||
@io.swagger.annotations.ApiModelProperty(value = "声纹名称(用于调微软接口)", name = "voice_name") | |||||
private String voiceName; | |||||
@io.swagger.annotations.ApiModelProperty(value = "声纹展示名称", name = "voice_display_name") | |||||
private String voiceDisplayName; | |||||
@io.swagger.annotations.ApiModelProperty(value = "性别(男1 女0)", name = "gender") | |||||
private int gender; | |||||
@io.swagger.annotations.ApiModelProperty(value = "声纹类型 共享:0 定制:1", name = "class") | |||||
private int voiceType; | |||||
@io.swagger.annotations.ApiModelProperty(value = "声纹风格名称(用于微软接口)", name = "style_name") | |||||
private String styleName; | |||||
@io.swagger.annotations.ApiModelProperty(value = "声纹风格展示名称", name = "style_display_name") | |||||
private String styleDisplayName; | |||||
@io.swagger.annotations.ApiModelProperty(value = "声纹风格样例文件链接", name = "style_demo") | |||||
private String styleDemo; | |||||
} | } |
@@ -0,0 +1,15 @@ | |||||
package com.iformall.mapper; | |||||
import com.iformall.common.CommonMapper; | |||||
import com.iformall.domain.po.WxCUserAuthority; | |||||
import java.util.List; | |||||
public interface WxCUserAuthorityMapper extends CommonMapper<WxCUserAuthority, String> { | |||||
List<WxCUserAuthority> getAuthorAvatar(String username, int i, Long resourceId); | |||||
List<WxCUserAuthority> getAuthorVoice(String username, int i, Long resourceId); | |||||
} |
@@ -0,0 +1,7 @@ | |||||
package com.iformall.service; | |||||
import com.iformall.common.ResultData; | |||||
public interface WxCUserAuthorityService { | |||||
ResultData getAuthor(String username, String code, Integer type, Long resourceId); | |||||
} |
@@ -0,0 +1,65 @@ | |||||
package com.iformall.service.impl; | |||||
import com.iformall.common.ResultData; | |||||
import com.iformall.domain.po.WxCUserAuthority; | |||||
import com.iformall.mapper.WxCUserAuthorityMapper; | |||||
import com.iformall.service.WxCUserAuthorityService; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Service; | |||||
import java.util.ArrayList; | |||||
import java.util.Date; | |||||
import java.util.HashMap; | |||||
import java.util.List; | |||||
@Service | |||||
public class WxCUserAuthorityServiceImpl implements WxCUserAuthorityService { | |||||
@Autowired | |||||
private WxCUserAuthorityMapper wxCUserAuthorityMapper; | |||||
@Override | |||||
public ResultData getAuthor(String username, String code, Integer type, Long resourceId) { | |||||
List<WxCUserAuthority> resultList = new ArrayList<WxCUserAuthority>(); | |||||
if (type==0){ | |||||
//查询数字人相关权限 | |||||
resultList = wxCUserAuthorityMapper.getAuthorAvatar(username,0,resourceId); | |||||
} | |||||
if (type==1){ | |||||
//查询声纹相关权限 | |||||
resultList = wxCUserAuthorityMapper.getAuthorVoice(username,1,resourceId); | |||||
} | |||||
if (resourceId==null){ | |||||
//若资源id没有传入那就展示所有当前类型资源权限 | |||||
HashMap<String, Object> resultMap = new HashMap<>(); | |||||
List authorList = new ArrayList(); | |||||
for (WxCUserAuthority wxCUserAuthority : resultList) { | |||||
HashMap<String, Object> author = new HashMap<>(); | |||||
author.put("username",wxCUserAuthority.getUserName()); | |||||
author.put("type",wxCUserAuthority.getType()); | |||||
author.put("resource_id",wxCUserAuthority.getResourceId()); | |||||
author.put("class",wxCUserAuthority.getClassType()); | |||||
author.put("current_time",new Date(System.currentTimeMillis())); | |||||
author.put("expire_time",wxCUserAuthority.getExpireTime()); | |||||
authorList.add(author); | |||||
} | |||||
resultMap.put("authorList",authorList); | |||||
} | |||||
HashMap<String, Object> resultMap = new HashMap<>(); | |||||
for (WxCUserAuthority wxCUserAuthority : resultList) { | |||||
resultMap.put("username",wxCUserAuthority.getUserName()); | |||||
resultMap.put("type",wxCUserAuthority.getType()); | |||||
resultMap.put("resource_id",wxCUserAuthority.getResourceId()); | |||||
resultMap.put("class",wxCUserAuthority.getClassType()); | |||||
resultMap.put("current_time",new Date(System.currentTimeMillis())); | |||||
resultMap.put("expire_time",wxCUserAuthority.getExpireTime()); | |||||
} | |||||
return new ResultData(resultMap); | |||||
} | |||||
} |
@@ -0,0 +1,29 @@ | |||||
<?xml version="1.0" encoding="UTF-8"?> | |||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.iformall.mapper.WxCUserAuthorityMapper"> | |||||
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxCUserAuthority"> | |||||
<result column="user_name" jdbcType="VARCHAR" property="userName"/> | |||||
<result column="type" jdbcType="VARCHAR" property="type"/> | |||||
<result column="resource_id" jdbcType="VARCHAR" property="resourceId"/> | |||||
<result column="class" jdbcType="VARCHAR" property="classType"/> | |||||
<result column="expire_time" jdbcType="VARCHAR" property="expireTime"/> | |||||
<result column="current_time" jdbcType="VARCHAR" property="expireTime"/> | |||||
</resultMap> | |||||
<select id="getAuthorAvatar" resultType="com.iformall.domain.po.WxCUserAuthority"> | |||||
select wca.user_name,wca.type,wca.resource_id,wca.expire_time,wcav.class | |||||
from wx_c_author wca | |||||
join wx_c_avatar wcav on wca.resource_id = wcav.id and wca.type = 0 | |||||
where wca.user_name=#{username} and wca.resource_id = #{resourceId} | |||||
</select> | |||||
<select id="getAuthorVoice" resultType="com.iformall.domain.po.WxCUserAuthority"> | |||||
select wca.user_name,wca.type,wca.resource_id,wca.expire_time,wcv.class | |||||
from wx_c_author wca | |||||
join wx_c_voice wcv on wca.resource_id =wcv.id and wca.type = 1 | |||||
where wca.user_name=#{username} and wca.resource_id = #{resourceId} | |||||
</select> | |||||
</mapper> |