机构管理增加TpLink用户
This commit is contained in:
parent
beb9729d9c
commit
8612e574f0
|
@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.nu.modules.tplink.common.entity.TumsConfig;
|
||||
import com.nu.modules.tplink.common.service.ITumsConfigService;
|
||||
import com.nu.modules.tplink.common.mapper.TumsConfigMapper;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
@ -42,7 +42,7 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
@Autowired
|
||||
private IErrorCodeService errorCodeService;
|
||||
@Autowired
|
||||
private ITumsConfigService tumsConfigService;
|
||||
private TumsConfigMapper tumsConfigMapper;
|
||||
|
||||
/**
|
||||
* 获取摄像头信息-分页
|
||||
|
@ -1833,7 +1833,7 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
List<CameraInfo> chnList = (List)chnMap.get("data");
|
||||
if(chnList!=null&&chnList.size()>0){
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
TumsConfig tumsConfig = tumsConfigService.getByCode(sysUser.getOrgCode());
|
||||
TumsConfig tumsConfig = tumsConfigMapper.getByCode(sysUser.getOrgCode());
|
||||
for(int j=0;j<chnList.size();j++){
|
||||
CameraInfo chn = chnList.get(j);
|
||||
Map<String,Object> playbackMap = getPlaybackUrl(chn,1);
|
||||
|
@ -2014,7 +2014,7 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
String multitransError = multitransMap.get("error").toString();
|
||||
if(multitransError.equals("0")){
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
TumsConfig tumsConfig = tumsConfigService.getByCode(sysUser.getOrgCode());
|
||||
TumsConfig tumsConfig = tumsConfigMapper.getByCode(sysUser.getOrgCode());
|
||||
CameraInfo entity = (CameraInfo)multitransMap.get("data");
|
||||
entity.setQueryAddress(tumsConfig.getTumsUrl());
|
||||
return Result.OK(entity);
|
||||
|
@ -2034,7 +2034,7 @@ public class CameraInfoServiceImpl extends ServiceImpl<CameraInfoMapper, CameraI
|
|||
@Override
|
||||
public Result uploadToServer(CameraInfo cameraInfo){
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
TumsConfig tumsConfig = tumsConfigService.getByCode(sysUser.getOrgCode());
|
||||
TumsConfig tumsConfig = tumsConfigMapper.getByCode(sysUser.getOrgCode());
|
||||
String deviceIndex = cameraInfo.getDeviceIndex();
|
||||
String parentId = cameraInfo.getParentId();
|
||||
String fileName = cameraInfo.getFileName();
|
||||
|
|
|
@ -9,9 +9,8 @@ import org.jeecg.common.api.vo.Result;
|
|||
import com.nu.modules.tplink.utils.TumsApi;
|
||||
import org.jeecg.common.system.vo.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -52,4 +51,23 @@ public class TpLinkController {
|
|||
tumsApi.destroyTumsClient();
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取图门系统用户
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(value = "/getUser")
|
||||
public Result<?> getUser(TumsConfig tumsConfig) {
|
||||
return tumsConfigService.getUser(tumsConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加和编辑图门系统用户
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/saveUser")
|
||||
public Result<String> saveUser(@RequestBody TumsConfig tumsConfig) {
|
||||
return tumsConfigService.saveUser(tumsConfig);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
package com.nu.modules.tplink.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
@ -21,9 +25,18 @@ import java.io.Serializable;
|
|||
@ApiModel(value="nu_iot_tplink_tums_base", description="护理单元-物联管理-TPLINK图门系统配置信息")
|
||||
public class TumsConfig implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**ID*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
@ApiModelProperty(value = "ID")
|
||||
private Integer id;
|
||||
private String tumsUrl; //获取图门系统地址
|
||||
private String tumsProjectId; //图门系统登录项目ID
|
||||
@TableField(exist = false)
|
||||
private String tumsProjectName; //图门系统登录项目ID
|
||||
private String tumsUserId; // 图门系统登录用户ID
|
||||
private String tumsUsername; // 获取图门系统用户
|
||||
private String tumsPassword; //获取图门系统密码
|
||||
private String tumsRoleId; //图门系统角色ID
|
||||
private String ftpIp; //回放视频转FTP上传IP
|
||||
private String ftpPort; //回放视频转FTP上传端口
|
||||
private String ftpUsername; //回放视频转FTP上传用户
|
||||
|
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||
import com.nu.modules.tplink.common.entity.TumsConfig;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 护理单元-物联管理-错误码
|
||||
* @Author: jeecg-boot
|
||||
|
@ -14,4 +16,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||
@Mapper
|
||||
public interface TumsConfigMapper extends BaseMapper<TumsConfig> {
|
||||
TumsConfig getByCode(String orgCode);
|
||||
TumsConfig findProjectByCodeOrId(TumsConfig tumsConfig);
|
||||
void addUser(Map<String, String> map);
|
||||
void updateUser(Map<String, String> map);
|
||||
}
|
||||
|
|
|
@ -6,8 +6,11 @@
|
|||
select
|
||||
id,
|
||||
tums_url as tumsUrl,
|
||||
tums_project_id as tumsProjectId,
|
||||
tums_userId as tumsUserId,
|
||||
tums_username as tumsUsername,
|
||||
tums_password as tumsPassword,
|
||||
tums_roleId as tumsRoleId,
|
||||
ftp_ip as ftpIp,
|
||||
ftp_port as ftpPort,
|
||||
ftp_username as ftpUsername,
|
||||
|
@ -27,4 +30,135 @@
|
|||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="findProjectByCodeOrId" parameterType="String" resultType="com.nu.modules.tplink.common.entity.TumsConfig">
|
||||
select p.project_id as tumsProjectId,
|
||||
p.project_name as tumsProjectName
|
||||
from nu_iot_tplink_project p
|
||||
inner join sys_depart d on p.institution_id = d.id
|
||||
<where>
|
||||
<if test="tumsProjectId != null and tumsProjectId != ''">
|
||||
AND p.project_id = #{tumsProjectId}
|
||||
</if>
|
||||
<if test="tumsProjectId == null or tumsProjectId == ''">
|
||||
AND d.org_code = #{orgCode}
|
||||
</if>
|
||||
</where>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="addUser">
|
||||
insert into nu_iot_tplink_tums_base(
|
||||
<if test="tumsUrl != null and tumsUrl != ''">
|
||||
tums_url,
|
||||
</if>
|
||||
<if test="tumsProjectId != null and tumsProjectId != ''">
|
||||
tums_project_id,
|
||||
</if>
|
||||
<if test="tumsUserId != null and tumsUserId != ''">
|
||||
tums_userId,
|
||||
</if>
|
||||
<if test="tumsUsername != null and tumsUsername != ''">
|
||||
tums_username,
|
||||
</if>
|
||||
<if test="tumsPassword != null and tumsPassword != ''">
|
||||
tums_password,
|
||||
</if>
|
||||
<if test="tumsRoleId != null and tumsRoleId != ''">
|
||||
tums_roleId,
|
||||
</if>
|
||||
<if test="ftpIp != null and ftpIp != ''">
|
||||
ftp_ip,
|
||||
</if>
|
||||
<if test="ftpPort != null and ftpPort != ''">
|
||||
ftp_port,
|
||||
</if>
|
||||
<if test="ftpUsername != null and ftpUsername != ''">
|
||||
ftp_username,
|
||||
</if>
|
||||
<if test="ftpPassword != null and ftpPassword != ''">
|
||||
ftp_password,
|
||||
</if>
|
||||
<if test="ftpUploadpath != null and ftpUploadpath != ''">
|
||||
ftp_uploadpath,
|
||||
</if>
|
||||
org_code
|
||||
)
|
||||
values(
|
||||
<if test="tumsUrl != null and tumsUrl != ''">
|
||||
#{tumsUrl},
|
||||
</if>
|
||||
<if test="tumsProjectId != null and tumsProjectId != ''">
|
||||
#{tumsProjectId},
|
||||
</if>
|
||||
<if test="tumsUserId != null and tumsUserId != ''">
|
||||
#{tumsUserId},
|
||||
</if>
|
||||
<if test="tumsUsername != null and tumsUsername != ''">
|
||||
#{tumsUsername},
|
||||
</if>
|
||||
<if test="tumsPassword != null and tumsPassword != ''">
|
||||
#{tumsPassword},
|
||||
</if>
|
||||
<if test="tumsRoleId != null and tumsRoleId != ''">
|
||||
#{tumsRoleId},
|
||||
</if>
|
||||
<if test="ftpIp != null and ftpIp != ''">
|
||||
#{ftpIp},
|
||||
</if>
|
||||
<if test="ftpPort != null and ftpPort != ''">
|
||||
#{ftpPort},
|
||||
</if>
|
||||
<if test="ftpUsername != null and ftpUsername != ''">
|
||||
#{ftpUsername},
|
||||
</if>
|
||||
<if test="ftpPassword != null and ftpPassword != ''">
|
||||
#{ftpPassword},
|
||||
</if>
|
||||
<if test="ftpUploadpath != null and ftpUploadpath != ''">
|
||||
#{ftpUploadpath},
|
||||
</if>
|
||||
#{orgCode}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateUser">
|
||||
update nu_iot_tplink_tums_base
|
||||
set
|
||||
<if test="tumsUrl != null and tumsUrl != ''">
|
||||
tums_url = #{tumsUrl},
|
||||
</if>
|
||||
<if test="tumsProjectId != null and tumsProjectId != ''">
|
||||
tums_project_id = #{tumsProjectId},
|
||||
</if>
|
||||
<if test="tumsUserId != null and tumsUserId != ''">
|
||||
tums_userId = #{tumsUserId},
|
||||
</if>
|
||||
<if test="tumsUsername != null and tumsUsername != ''">
|
||||
tums_username = #{tumsUsername},
|
||||
</if>
|
||||
<if test="tumsPassword != null and tumsPassword != ''">
|
||||
tums_password = #{tumsPassword},
|
||||
</if>
|
||||
<if test="tumsRoleId != null and tumsRoleId != ''">
|
||||
tums_roleId = #{tumsRoleId},
|
||||
</if>
|
||||
<if test="ftpIp != null and ftpIp != ''">
|
||||
ftp_ip = #{ftpIp},
|
||||
</if>
|
||||
<if test="ftpPort != null and ftpPort != ''">
|
||||
ftp_port = #{ftpPort},
|
||||
</if>
|
||||
<if test="ftpUsername != null and ftpUsername != ''">
|
||||
ftp_username = #{ftpUsername},
|
||||
</if>
|
||||
<if test="ftpPassword != null and ftpPassword != ''">
|
||||
ftp_password = #{ftpPassword},
|
||||
</if>
|
||||
<if test="ftpUploadpath != null and ftpUploadpath != ''">
|
||||
ftp_uploadpath = #{ftpUploadpath},
|
||||
</if>
|
||||
org_code = #{orgCode}
|
||||
where org_code = #{orgCode}
|
||||
</update>
|
||||
|
||||
</mapper>
|
|
@ -2,6 +2,7 @@ package com.nu.modules.tplink.common.service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nu.modules.tplink.common.entity.TumsConfig;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
|
||||
/**
|
||||
* @Description: 护理单元-物联管理-图门系统配置
|
||||
|
@ -11,4 +12,6 @@ import com.nu.modules.tplink.common.entity.TumsConfig;
|
|||
*/
|
||||
public interface ITumsConfigService extends IService<TumsConfig> {
|
||||
TumsConfig getByCode(String orgCode);
|
||||
Result<?> getUser(TumsConfig tumsConfig);
|
||||
Result<String> saveUser(TumsConfig tumsConfig);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,23 @@
|
|||
package com.nu.modules.tplink.common.service.impl;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nu.modules.tplink.common.entity.TumsConfig;
|
||||
import com.nu.modules.tplink.common.mapper.TumsConfigMapper;
|
||||
import com.nu.modules.tplink.common.service.ITumsConfigService;
|
||||
import com.nu.modules.tplink.utils.RsaDecryptUtils;
|
||||
import com.nu.modules.tplink.utils.TumsApi;
|
||||
import com.tplink.ignite.libs.developersdk.utils.RsaUtils;
|
||||
import com.tplink.ignite.libs.developersdk.vo.EncryptKeyForLoginResponseVO;
|
||||
import me.zhyd.oauth.log.Log;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Description: 护理单元-物联管理-图门系统配置
|
||||
* @Author: caolei
|
||||
|
@ -15,9 +27,141 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class TumsConfigServiceImpl extends ServiceImpl<TumsConfigMapper, TumsConfig> implements ITumsConfigService {
|
||||
|
||||
@Autowired
|
||||
private TumsApi tumsApi;
|
||||
|
||||
@Override
|
||||
public TumsConfig getByCode(String orgCode){
|
||||
return baseMapper.getByCode(orgCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> getUser(TumsConfig tumsConfig){
|
||||
TumsConfig entity = baseMapper.getByCode(tumsConfig.getOrgCode());
|
||||
if(entity == null){
|
||||
entity = new TumsConfig();
|
||||
entity.setOrgCode(tumsConfig.getOrgCode());
|
||||
}
|
||||
TumsConfig project = baseMapper.findProjectByCodeOrId(entity);
|
||||
if(project!=null){
|
||||
entity.setTumsProjectId(project.getTumsProjectId());
|
||||
entity.setTumsProjectName(project.getTumsProjectName());
|
||||
}
|
||||
return Result.OK(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<String> saveUser(TumsConfig tumsConfig){
|
||||
|
||||
TumsConfig entity = baseMapper.getByCode(tumsConfig.getOrgCode());
|
||||
if(entity!=null){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("{");
|
||||
sb.append("\"userId\"").append(":").append("\"").append(tumsConfig.getTumsUserId()).append("\",");
|
||||
sb.append("\"roleList\"").append(":[").append(tumsConfig.getTumsRoleId()).append("]");
|
||||
sb.append("\"password\"").append(":").append("\"").append(tumsConfig.getTumsPassword()).append("\"");
|
||||
sb.append("}");
|
||||
String jsonResponse = tumsApi.editUser(sb.toString());
|
||||
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||
String errorCode = jsonObject.getStr("error_code");
|
||||
if(errorCode.equals("0")){
|
||||
// StringBuffer sbp = new StringBuffer();
|
||||
// sbp.append("{");
|
||||
// sbp.append("\"userId\"").append(":").append("\"").append(tumsConfig.getTumsUserId()).append("\",");
|
||||
// sbp.append("\"password\"").append(":").append("\"").append(tumsConfig.getTumsPassword()).append("\"");
|
||||
// sbp.append("}");
|
||||
// String jsonResponsep = tumsApi.changePassword(sbp.toString());
|
||||
// JSONObject jsonObjectp = new JSONObject(jsonResponsep);
|
||||
// String errorCodep = jsonObjectp.getStr("error_code");
|
||||
// if(errorCodep.equals("0")){
|
||||
Map<String, String> map = new HashMap<>();
|
||||
if(tumsConfig.getTumsUrl()!=null&&!tumsConfig.getTumsUrl().equals("")){
|
||||
map.put("tumsUrl",tumsConfig.getTumsUrl());
|
||||
}
|
||||
if(tumsConfig.getTumsProjectId()!=null&&!tumsConfig.getTumsProjectId().equals("")){
|
||||
map.put("tumsProjectId",tumsConfig.getTumsProjectId());
|
||||
}
|
||||
if(tumsConfig.getFtpIp()!=null&&!tumsConfig.getFtpIp().equals("")){
|
||||
map.put("ftpIp",tumsConfig.getFtpIp());
|
||||
}
|
||||
if(tumsConfig.getFtpPort()!=null&&!tumsConfig.getFtpPort().equals("")){
|
||||
map.put("ftpPort",tumsConfig.getFtpPort());
|
||||
}
|
||||
if(tumsConfig.getFtpUsername()!=null&&!tumsConfig.getFtpUsername().equals("")){
|
||||
map.put("ftpUsername",tumsConfig.getFtpUsername());
|
||||
}
|
||||
if(tumsConfig.getFtpPassword()!=null&&!tumsConfig.getFtpPassword().equals("")){
|
||||
map.put("ftpPassword",tumsConfig.getFtpPassword());
|
||||
}
|
||||
if(tumsConfig.getFtpUploadpath()!=null&&!tumsConfig.getFtpUploadpath().equals("")){
|
||||
map.put("ftpUploadpath",tumsConfig.getFtpUploadpath());
|
||||
}
|
||||
if(tumsConfig.getOrgCode()!=null&&!tumsConfig.getOrgCode().equals("")){
|
||||
map.put("orgCode",tumsConfig.getOrgCode());
|
||||
}
|
||||
baseMapper.updateUser(map);
|
||||
return Result.OK("编辑用户成功!");
|
||||
// }else{
|
||||
// if(errorCodep.equals("-82400")){
|
||||
// return Result.error("密码格式错误");
|
||||
// }else{
|
||||
// return Result.error(jsonObject.getStr("msg"));
|
||||
// }
|
||||
// }
|
||||
}else{
|
||||
return Result.error(jsonObject.getStr("msg"));
|
||||
}
|
||||
}else {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("{");
|
||||
sb.append("\"projectId\"").append(":").append("\"").append(tumsConfig.getTumsProjectId()).append("\",");
|
||||
sb.append("\"username\"").append(":").append("\"").append(tumsConfig.getTumsUsername()).append("\",");
|
||||
sb.append("\"password\"").append(":").append("\"").append(tumsConfig.getTumsPassword()).append("\",");
|
||||
sb.append("\"roleList\"").append(":[").append(tumsConfig.getTumsRoleId()).append("]");
|
||||
sb.append("}");
|
||||
String jsonResponse = tumsApi.addUser(sb.toString());
|
||||
JSONObject jsonObject = new JSONObject(jsonResponse);
|
||||
String errorCode = jsonObject.getStr("error_code");
|
||||
if(errorCode.equals("0")){
|
||||
JSONObject result = (JSONObject)jsonObject.get("result");
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("tumsUserId",result.getStr("userId"));
|
||||
map.put("tumsUsername",result.getStr("username"));
|
||||
map.put("tumsPassword",tumsConfig.getTumsPassword());
|
||||
map.put("tumsRoleId",tumsConfig.getTumsRoleId());
|
||||
if(tumsConfig.getTumsUrl()!=null&&!tumsConfig.getTumsUrl().equals("")){
|
||||
map.put("tumsUrl",tumsConfig.getTumsUrl());
|
||||
}
|
||||
if(tumsConfig.getTumsProjectId()!=null&&!tumsConfig.getTumsProjectId().equals("")){
|
||||
map.put("tumsProjectId",tumsConfig.getTumsProjectId());
|
||||
}
|
||||
if(tumsConfig.getFtpIp()!=null&&!tumsConfig.getFtpIp().equals("")){
|
||||
map.put("ftpIp",tumsConfig.getFtpIp());
|
||||
}
|
||||
if(tumsConfig.getFtpPort()!=null&&!tumsConfig.getFtpPort().equals("")){
|
||||
map.put("ftpPort",tumsConfig.getFtpPort());
|
||||
}
|
||||
if(tumsConfig.getFtpUsername()!=null&&!tumsConfig.getFtpUsername().equals("")){
|
||||
map.put("ftpUsername",tumsConfig.getFtpUsername());
|
||||
}
|
||||
if(tumsConfig.getFtpPassword()!=null&&!tumsConfig.getFtpPassword().equals("")){
|
||||
map.put("ftpPassword",tumsConfig.getFtpPassword());
|
||||
}
|
||||
if(tumsConfig.getFtpUploadpath()!=null&&!tumsConfig.getFtpUploadpath().equals("")){
|
||||
map.put("ftpUploadpath",tumsConfig.getFtpUploadpath());
|
||||
}
|
||||
if(tumsConfig.getOrgCode()!=null&&!tumsConfig.getOrgCode().equals("")){
|
||||
map.put("orgCode",tumsConfig.getOrgCode());
|
||||
}
|
||||
baseMapper.addUser(map);
|
||||
return Result.OK("添加用户成功!");
|
||||
}else{
|
||||
if(errorCode.equals("-82400")){
|
||||
return Result.error("密码格式错误");
|
||||
}else{
|
||||
return Result.error(jsonObject.getStr("msg"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,9 @@ public enum ApiEnum {
|
|||
GET_ENCRYPT_KEY_FOR_LOGIN("/tums/account/v1/getEncryptKeyForLogin","获取登录公钥"),
|
||||
LOGIN("/tums/account/v2/login","登录"),
|
||||
LOGOUT("/tums/account/v1/logout","注销"),
|
||||
ADD_USER("/tums/account/v2/customCreateAccount","添加自定义用户"),
|
||||
EDIT_USER("/tums/account/v2/editUser","编辑用户"),
|
||||
CHANGE_PASSWORD("/tums/account/v2/changePassword","修改密码"),
|
||||
SET_CURRENT_PROJECT("/tums/resource/v2/setCurrentProject","设置当前项目"),
|
||||
GET_ALL_PROJECT_INFO("/tums/resource/v2/getAllProjectInfo","获取所有项目信息"),
|
||||
ADD_PROJECT("/tums/resource/v2/addProject","添加项目信息"),
|
||||
|
|
|
@ -47,7 +47,7 @@ public class ProjectInfo implements Serializable {
|
|||
/**机构ID*/
|
||||
@Excel(name = "机构ID", width = 15)
|
||||
@ApiModelProperty(value = "机构ID")
|
||||
@Dict(dicCode = "id" , dictTable = "nu_admin_institution_area" , dicText = "inst_name")
|
||||
@Dict(dicCode = "id" , dictTable = "sys_depart" , dicText = "depart_name")
|
||||
private String institutionId;
|
||||
/**创建时间戳,单位秒*/
|
||||
@ApiModelProperty(value = "创建时间戳,单位秒")
|
||||
|
|
|
@ -44,11 +44,11 @@ public class RegionInfo implements Serializable {
|
|||
/**机构ID*/
|
||||
@Excel(name = "区域ID", width = 15)
|
||||
@ApiModelProperty(value = "区域ID")
|
||||
@Dict(dicCode = "id" , dictTable = "nu_admin_institution_area" , dicText = "inst_name")
|
||||
@Dict(dicCode = "id" , dictTable = "sys_depart" , dicText = "depart_name")
|
||||
private String areaId;
|
||||
@Excel(name = "机构ID", width = 15)
|
||||
@ApiModelProperty(value = "机构ID")
|
||||
@Dict(dicCode = "id" , dictTable = "nu_admin_institution_area" , dicText = "inst_name")
|
||||
@Dict(dicCode = "id" , dictTable = "sys_depart" , dicText = "depart_name")
|
||||
private String institutionId;
|
||||
/**分组层级*/
|
||||
@Excel(name = "分组层级", width = 15)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.nu.modules.tplink.utils;
|
||||
|
||||
import com.nu.modules.tplink.common.entity.TumsConfig;
|
||||
import com.nu.modules.tplink.common.service.ITumsConfigService;
|
||||
import com.nu.modules.tplink.common.mapper.TumsConfigMapper;
|
||||
import com.tplink.ignite.libs.developersdk.api.TumsClient;
|
||||
import com.tplink.ignite.libs.developersdk.vo.ResultVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
@ -18,8 +18,9 @@ public class TumsApi {
|
|||
TumsClient tumsClient;
|
||||
|
||||
TumsConfig tumsConfig;
|
||||
|
||||
@Autowired
|
||||
private ITumsConfigService tumsConfigService;
|
||||
private TumsConfigMapper tumsConfigMapper;
|
||||
|
||||
/**
|
||||
* 创建tumsClient
|
||||
|
@ -44,10 +45,15 @@ public class TumsApi {
|
|||
private void initTumsConfig(){
|
||||
if(tumsConfig==null){
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
tumsConfig = tumsConfigService.getByCode(sysUser.getOrgCode());
|
||||
tumsConfig = tumsConfigMapper.getByCode(sysUser.getOrgCode());
|
||||
}
|
||||
}
|
||||
|
||||
public String getRsaKey(){
|
||||
login();
|
||||
return tumsClient.getRsaKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* @return
|
||||
|
@ -84,6 +90,45 @@ public class TumsApi {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加自定义用户
|
||||
* @param jsonRequest
|
||||
* @return
|
||||
*/
|
||||
public String addUser(String jsonRequest){
|
||||
this.createTumsClient();
|
||||
log.info("addUser:request:{}",jsonRequest);
|
||||
String jsonResponse = tumsClient.requestEncryptedApi(jsonRequest, ApiEnum.ADD_USER.getValue());
|
||||
log.info("addUser:response:{}",jsonResponse);
|
||||
return jsonResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑用户
|
||||
* @param jsonRequest
|
||||
* @return
|
||||
*/
|
||||
public String editUser(String jsonRequest){
|
||||
this.createTumsClient();
|
||||
log.info("editUser:request:{}",jsonRequest);
|
||||
String jsonResponse = tumsClient.requestEncryptedApi(jsonRequest, ApiEnum.EDIT_USER.getValue());
|
||||
log.info("editUser:response:{}",jsonResponse);
|
||||
return jsonResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑用户
|
||||
* @param jsonRequest
|
||||
* @return
|
||||
*/
|
||||
public String changePassword(String jsonRequest){
|
||||
this.createTumsClient();
|
||||
log.info("changePassword:request:{}",jsonRequest);
|
||||
String jsonResponse = tumsClient.requestEncryptedApi(jsonRequest, ApiEnum.CHANGE_PASSWORD.getValue());
|
||||
log.info("changePassword:response:{}",jsonResponse);
|
||||
return jsonResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前项目
|
||||
* @param jsonRequest
|
||||
|
|
|
@ -708,4 +708,20 @@ public class SysDepartController {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有子区域信息
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("queryChildrenByParentId")
|
||||
public Result<List<SysDepart>> queryChildrenByParentId(@RequestParam(name = "pid", required = false) String parentId) {
|
||||
Result<List<SysDepart>> result = new Result<>();
|
||||
LambdaQueryWrapper<SysDepart> query = new LambdaQueryWrapper<SysDepart>();
|
||||
query.orderByAsc(SysDepart::getDepartName);
|
||||
query.eq(SysDepart::getParentId,parentId);
|
||||
List<SysDepart> ls = this.sysDepartService.list(query);
|
||||
result.setSuccess(true);
|
||||
result.setResult(ls);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue