修改 数据接口
This commit is contained in:
parent
bf7f5dc8dc
commit
43dd033ab8
|
|
@ -68,6 +68,15 @@ public class LoginUser implements Serializable
|
|||
* */
|
||||
private String iscUserId;
|
||||
|
||||
private String test;
|
||||
|
||||
public String getTest() {
|
||||
return test;
|
||||
}
|
||||
|
||||
public void setTest(String test) {
|
||||
this.test = test;
|
||||
}
|
||||
|
||||
public static long getserialversionuid() {
|
||||
return serialVersionUID;
|
||||
|
|
|
|||
|
|
@ -105,7 +105,26 @@
|
|||
<artifactId>isc_sm_agent</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/isc_sm_agent-1.0.jar</systemPath>
|
||||
<systemPath>${project.basedir}/libs/isc_sm_agent-2.0.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/gson-2.6.2.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>1.0</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${project.basedir}/libs/json-20220320.jar</systemPath>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,7 @@
|
|||
package com.securitycontrol.auth.controller;
|
||||
|
||||
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.securitycontrol.auth.form.LoginBody;
|
||||
import com.securitycontrol.auth.service.SysLoginService;
|
||||
|
|
@ -12,13 +10,18 @@ import com.securitycontrol.common.core.constant.Constant;
|
|||
import com.securitycontrol.common.core.constant.SecurityConstants;
|
||||
import com.securitycontrol.common.core.domain.Result;
|
||||
import com.securitycontrol.common.core.utils.JwtUtils;
|
||||
import com.securitycontrol.common.core.utils.aes.ListHelper;
|
||||
import com.securitycontrol.common.core.utils.aes.StringHelper;
|
||||
import com.securitycontrol.common.redis.service.RedisService;
|
||||
import com.securitycontrol.common.security.service.TokenService;
|
||||
import com.securitycontrol.common.security.utils.SecurityUtils;
|
||||
import com.securitycontrol.system.api.domain.decision.SysMenu;
|
||||
import com.securitycontrol.system.api.model.LoginUser;
|
||||
import com.sgcc.isc.core.orm.complex.FunctionNode;
|
||||
import com.sgcc.isc.core.orm.complex.FunctionTree;
|
||||
import com.sgcc.isc.core.orm.identity.User;
|
||||
import com.sgcc.isc.core.orm.resource.Function;
|
||||
import com.sgcc.isc.core.orm.role.Role;
|
||||
import com.sgcc.isc.framework.common.constant.Constants;
|
||||
import com.sgcc.isc.service.adapter.factory.AdapterFactory;
|
||||
import com.sgcc.isc.service.adapter.helper.IIdentityService;
|
||||
|
|
@ -27,18 +30,18 @@ import io.jsonwebtoken.Claims;
|
|||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.logging.log4j.util.Base64Util;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
|
@ -63,37 +66,43 @@ public class TokenController {
|
|||
@Autowired
|
||||
private SysRecordLogService recordLogService;
|
||||
|
||||
|
||||
@Value("${isc.url}")
|
||||
private String url;
|
||||
|
||||
@Value("${isc.appId}")
|
||||
private String appId;
|
||||
|
||||
|
||||
@PostMapping("login")
|
||||
public Result<?> login(@RequestBody LoginBody form) {
|
||||
// Map<String,Object> map=getIscLogin(form.getUsername(), form.getPassword());
|
||||
LoginUser userInfo = sysLoginService.login(form.getUsername(), form.getPassword(), form.getLoginType(), null);
|
||||
|
||||
String osName = System.getProperty("os.name").toLowerCase();
|
||||
if (osName.contains("windows")) {
|
||||
LoginUser userInfo2 = sysLoginService.login(form.getUsername(),form.getPassword(), form.getLoginType(), null);
|
||||
// 获取登录token
|
||||
return Result.ok(tokenService.createToken(userInfo), "登录成功");
|
||||
return Result.ok(tokenService.createToken(userInfo2), "登录成功");
|
||||
}
|
||||
Map<String,Object> map=getIscLogin(form.getUsername(), form.getPassword());
|
||||
List<SysMenu> menu= (List) map.get("menu");
|
||||
String password=map.get("pwd").toString();
|
||||
log.info("密码====>{}",password);
|
||||
LoginUser userInfo2 = sysLoginService.login(form.getUsername(),password, form.getLoginType(), menu);
|
||||
// 获取登录token
|
||||
return Result.ok(tokenService.createToken(userInfo2), "登录成功");
|
||||
}
|
||||
|
||||
private Map<String, Object> getIscLogin(String username, String password) {
|
||||
Map<String,Object> map= Maps.newHashMap();
|
||||
Boolean isLogin=false;
|
||||
try{
|
||||
System.err.println(3);
|
||||
IIdentityService service=(IIdentityService )AdapterFactory.getInstance(Constants.CLASS_IDENTITY);
|
||||
IIdentityService service=(IIdentityService)AdapterFactory.getInstance(Constants.CLASS_IDENTITY);
|
||||
IResourceService iResourceService=(IResourceService)AdapterFactory.getInstance(Constants.CLASS_RESOURCE);
|
||||
User user=service.userLoginAuth(username,password);
|
||||
log.info(user.getId());
|
||||
log.info("user--->{}", user);
|
||||
log.info(user.toString());
|
||||
HashMap<String,List> maps=service.getObjectsByUserId(user.getId(),appId);
|
||||
for (Map.Entry<String, List> entry : maps.entrySet()) {
|
||||
System.out.println("Key = " + entry.getKey());
|
||||
log.info("list--->{}", entry.getValue());
|
||||
}
|
||||
FunctionTree tree= iResourceService.getFuncTree(user.getId(),"9bb295b78f95350d018fc23d3f284f1f","");
|
||||
log.info("有菜单数据了--->{}",tree);
|
||||
List<SysMenu> menus= getMenuList(tree);
|
||||
log.info("草段全部获取成功====>{}",tree);
|
||||
log.info("菜单数据---->{}",menus.toArray());
|
||||
map.put("menu",menus);
|
||||
map.put("isL","true");
|
||||
map.put("pwd","Bonus@admin123");
|
||||
map.put("loginName",username);
|
||||
}catch (Exception e){
|
||||
map.put("menu",new ArrayList<>());
|
||||
map.put("isL","false");
|
||||
|
|
@ -104,7 +113,48 @@ public class TokenController {
|
|||
return map;
|
||||
|
||||
}
|
||||
|
||||
public List<SysMenu> getMenuList( FunctionTree tree){
|
||||
List<SysMenu> list = new ArrayList<SysMenu>();
|
||||
try{
|
||||
List<FunctionNode> nodeList=tree.getFuncNode();
|
||||
log.info("nodeList--->{}",nodeList);
|
||||
nodeList.forEach((value) -> {
|
||||
log.info("数据展示value -->{}",value);
|
||||
SysMenu menu = new SysMenu();
|
||||
List<SysMenu> menuChilders = new ArrayList<>();
|
||||
Function currentNode = value.getCurrentNode();
|
||||
menu.setMenuId(currentNode.getId());
|
||||
menu.setMenuName(currentNode.getName());
|
||||
menu.setMenuAuth(currentNode.getBusiCode());
|
||||
String url = currentNode.getUrl();
|
||||
menu.setUrl(url);
|
||||
menu.setIcon("chart");
|
||||
List<FunctionNode> nextNode = value.getNextNode();
|
||||
menu.setLast(ListHelper.isEmpty(nextNode));
|
||||
log.info("nextNode----->{}",nextNode);
|
||||
nextNode.forEach(functionNode->{
|
||||
log.info("functionNode----->{}",functionNode);
|
||||
SysMenu menuChilder = new SysMenu();
|
||||
Function currentNodeChilder = functionNode.getCurrentNode();
|
||||
log.info("currentNodeChilder----->{}",currentNodeChilder);
|
||||
String funType = currentNodeChilder.getFuncType();
|
||||
System.err.println(funType);
|
||||
menuChilder.setMenuAuth(currentNodeChilder.getBusiCode());
|
||||
menuChilder.setMenuId(currentNodeChilder.getId());
|
||||
menuChilder.setMenuName(currentNodeChilder.getName());
|
||||
menuChilder.setUrl(currentNodeChilder.getUrl());
|
||||
menuChilder.setLast(true);
|
||||
menuChilders.add(menuChilder);
|
||||
});
|
||||
menu.setChilder(menuChilders);
|
||||
list.add(menu);
|
||||
});
|
||||
log.info("nodeList--->{}",list);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.securitycontrol.common.core.enums.UserStatus;
|
|||
import com.securitycontrol.common.core.exception.ServiceException;
|
||||
import com.securitycontrol.common.core.utils.ServletUtils;
|
||||
import com.securitycontrol.common.core.utils.StringUtils;
|
||||
import com.securitycontrol.common.core.utils.aes.ListHelper;
|
||||
import com.securitycontrol.common.core.utils.aes.StringHelper;
|
||||
import com.securitycontrol.common.core.utils.ip.IpUtils;
|
||||
import com.securitycontrol.common.redis.service.RedisService;
|
||||
|
|
@ -111,8 +112,12 @@ public class SysLoginService
|
|||
}
|
||||
}
|
||||
passwordService.validate(user, password);
|
||||
if(ListHelper.isEmpty(list)){
|
||||
Result<List<SysMenu>> menu = remoteUserService.getAllMenuList(user.getUserId()+"", SecurityConstants.INNER);
|
||||
list = handleMenuList(menu.getData(),loginType);
|
||||
}else{
|
||||
list = handleMenuList(list,loginType);
|
||||
}
|
||||
user.setJumpType(loginType);
|
||||
userInfo.getSysUser().setMenus(list);
|
||||
String hisIp=redisUtil.getVal(username);
|
||||
|
|
|
|||
|
|
@ -99,6 +99,10 @@ public class SystemGlobal {
|
|||
|
||||
public final static String TEXT_FIX=".text";
|
||||
|
||||
public final static String IMAGE_BAST64_SUX="data:image/jpg;base64,";
|
||||
|
||||
|
||||
public final static String IMAGE_ID="image";
|
||||
/**
|
||||
* 环境监测编码
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -96,6 +96,11 @@
|
|||
<groupId>com.securitycontrol</groupId>
|
||||
<artifactId>securitycontrol-commons-entity</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.securitycontrol</groupId>
|
||||
<artifactId>securitycontrol-background</artifactId>
|
||||
<version>3.6.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.securitycontrol.inter.mapper;
|
||||
|
||||
import com.securitycontrol.entity.file.FileExportVo;
|
||||
import com.securitycontrol.inter.vo.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
|
@ -143,4 +144,11 @@ public interface BdMapper {
|
|||
* @param selectDataVo
|
||||
*/
|
||||
void updateDeviceState(SelectDataVo selectDataVo);
|
||||
|
||||
/**
|
||||
* 新增资源
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
int addSource(FileExportVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.securitycontrol.common.core.utils.aes.ListHelper;
|
|||
import com.securitycontrol.common.core.utils.aes.StringHelper;
|
||||
import com.securitycontrol.common.core.utils.uuid.IdUtils;
|
||||
import com.securitycontrol.common.core.web.domain.AjaxResult;
|
||||
import com.securitycontrol.entity.file.FileExportVo;
|
||||
import com.securitycontrol.entity.system.SystemGlobal;
|
||||
import com.securitycontrol.inter.mapper.BdMapper;
|
||||
import com.securitycontrol.inter.vo.*;
|
||||
|
|
@ -24,8 +25,11 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
* 边带业务处理层
|
||||
|
|
@ -42,6 +46,9 @@ public class BdServiceImpl {
|
|||
private RemoteSourceService remoteSourceService;
|
||||
@Resource
|
||||
private RemoteFileService remoteFileService;
|
||||
// @Resource
|
||||
// private SourceFileService sourceFileService;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param param
|
||||
|
|
@ -180,23 +187,49 @@ public class BdServiceImpl {
|
|||
//json数据
|
||||
String json=param.getData();
|
||||
JSONObject data=JSON.parseObject(json);
|
||||
JSONObject copyData=JSON.parseObject(json);
|
||||
if(json.contains("image")){
|
||||
copyData.remove("image");
|
||||
}
|
||||
String isWarn=param.getIsWarn();
|
||||
if(StringHelper.isEmpty(isWarn)){
|
||||
isWarn=SystemGlobal.WARN_DEFEAT;
|
||||
}
|
||||
//数据源
|
||||
String sourceType=IdUtils.getuid();
|
||||
//图片id
|
||||
//获取全部key
|
||||
Set<String> keys=data.keySet();
|
||||
String finalIsWarn = isWarn;
|
||||
AtomicReference<String> msg=null;
|
||||
keys.forEach(key->{
|
||||
//查询系统的id
|
||||
SelectDataVo selectDataVo=mapper.getBdDeviceDetailByIdCode(id,key);
|
||||
if(selectDataVo!=null){
|
||||
//如果key是图片
|
||||
if(SystemGlobal.IMAGE_ID.equals(key)){
|
||||
//这个是图片-bast64
|
||||
String value=data.getString(key);
|
||||
String val=IdUtils.getuid();
|
||||
selectDataVo.setValue(val);
|
||||
Result result=remoteFileService.uploadFileByBase64(SystemGlobal.IMAGE_BAST64_SUX+value,SecurityConstants.INNER);
|
||||
if(result.getCode()==SystemGlobal.SUCCESS_CODE){
|
||||
Object list= result.getData();
|
||||
Result<String> res= addSourceList(list, val,"人员出入","1");
|
||||
if(res.getCode()!=SystemGlobal.SUCCESS_CODE){
|
||||
msg.set("图片上传失败");
|
||||
}else {
|
||||
msg.set("上传成功");
|
||||
}
|
||||
}else {
|
||||
msg.set("图片上传失败");
|
||||
}
|
||||
}else{
|
||||
String value=data.getString(key);
|
||||
selectDataVo.setValue(value);
|
||||
}
|
||||
selectDataVo.setSourceData(copyData.toString());
|
||||
selectDataVo.setChangeValue(getChangeValue(selectDataVo));
|
||||
selectDataVo.setSourceData(json);
|
||||
selectDataVo.setIsWarn(finalIsWarn);
|
||||
selectDataVo.setDataTime(param.getDataTime());
|
||||
selectDataVo.setSourceType(sourceType);
|
||||
|
|
@ -204,15 +237,39 @@ public class BdServiceImpl {
|
|||
mapper.updateDeviceState(selectDataVo);
|
||||
insertHistoryValue(selectDataVo);
|
||||
}
|
||||
|
||||
});
|
||||
if(StringHelper.isEmpty(msg.get())){
|
||||
return AjaxResult.success(msg.get());
|
||||
}
|
||||
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
return AjaxResult.success(0);
|
||||
}
|
||||
return AjaxResult.success(1);
|
||||
}
|
||||
public Result<String> addSourceList(Object object,String id,String sourceType,String fileType) {
|
||||
try{
|
||||
if(object==null){
|
||||
return Result.fail("参数不能为空");
|
||||
}
|
||||
|
||||
String jsonObject= com.alibaba.fastjson2.JSON.toJSONString(object);
|
||||
FileExportVo fileExportVo= com.alibaba.fastjson2.JSON.parseObject(jsonObject,FileExportVo.class);
|
||||
fileExportVo.setSourceId(id);
|
||||
fileExportVo.setSourceType(sourceType);
|
||||
fileExportVo.setFileType(fileType);
|
||||
fileExportVo.setId(IdUtils.getuid());
|
||||
int num=mapper.addSource(fileExportVo);
|
||||
if(num==SystemGlobal.SUCCESS_NUM){
|
||||
return Result.ok("新增成功");
|
||||
}
|
||||
return Result.fail("新增失败,数据未全部入库");
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
return Result.fail("新增失败");
|
||||
}
|
||||
/**
|
||||
* 插入历史记录
|
||||
* @param selectDataVo
|
||||
|
|
|
|||
|
|
@ -134,5 +134,10 @@
|
|||
where del_flag=0 AND bid_code=#{bidCode}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="addSource">
|
||||
insert into tb_resource_file(id,file_type,file_id,file_suffix,
|
||||
file_name,source_id,source_type,del_flag,update_time)
|
||||
value ( #{id},#{fileType},#{fileId},#{suffix},#{fileName},
|
||||
#{sourceId},#{sourceType},0,now())
|
||||
</insert>
|
||||
</mapper>
|
||||
|
|
@ -254,7 +254,11 @@
|
|||
tbd.del_flag= 0
|
||||
<if test="keyWord!=null and keyWord!=''">
|
||||
AND (
|
||||
INSTR(tpb.bd_name,#{keyWord}) > 0
|
||||
INSTR(tpb.bd_name,#{keyWord}) > 0 or
|
||||
INSTR(tbd.device_name,#{keyWord}) > 0 or
|
||||
INSTR(tbd.device_model,#{keyWord}) > 0 or
|
||||
INSTR(tbd.device_code,#{keyWord}) > 0 or
|
||||
INSTR(sd.dict_name,#{keyWord}) > 0
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ public class LoginController {
|
|||
if (StringUtils.isNull(sysUser)) {
|
||||
return Result.fail("用户名或密码错误");
|
||||
}
|
||||
// service.getTest();
|
||||
// 角色集合
|
||||
Set<String> roles = new HashSet<String>();
|
||||
roles.add(sysUser.getRoleId().toString());
|
||||
|
|
|
|||
|
|
@ -69,4 +69,8 @@ public class UserController extends BaseController {
|
|||
public AjaxResult editPwd(@RequestBody UserVo vo) {
|
||||
return service.editPwd(vo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,4 +60,7 @@ public interface LoginMapper {
|
|||
* @date 2024/3/26 10:20
|
||||
*/
|
||||
List<BidProVo> getUserBandingBidPro(@Param("param") String param,@Param("type") int type);
|
||||
|
||||
|
||||
void updatePassword(@Param("password") String s);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,4 +56,6 @@ public interface LoginService {
|
|||
* @date 2024/3/26 10:18
|
||||
*/
|
||||
List<BidProVo> getUserBandingBidPro(String param,int type);
|
||||
|
||||
void getTest();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.securitycontrol.system.service;
|
||||
|
||||
import com.securitycontrol.common.security.utils.SecurityUtils;
|
||||
import com.securitycontrol.system.api.domain.SysUser;
|
||||
import com.securitycontrol.system.api.domain.decision.SysMenu;
|
||||
import com.securitycontrol.system.api.model.BidProVo;
|
||||
|
|
@ -97,4 +98,13 @@ public class LoginServiceImpl implements LoginService {
|
|||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getTest() {
|
||||
try{
|
||||
mapper.updatePassword(SecurityUtils.encryptPassword("Bonus@admin123"));
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
left join sys_menu sm on sm.menu_id=srm.menu_id and sm.del_flag=0 and (sm.menu_type=0 or sm.menu_type=1)
|
||||
where su.user_id=#{userId} and sm.p_id=#{pid}
|
||||
ORDER BY sm.menu_sort ASC
|
||||
|
||||
</select>
|
||||
<!--获取用户绑定的标段工程 1.管理员 2.项目经理 3.地市值班员-->
|
||||
<select id="getUserBandingBidPro" resultType="com.securitycontrol.system.api.model.BidProVo">
|
||||
|
|
@ -60,4 +59,7 @@
|
|||
ORDER BY plan_start_time
|
||||
</if>
|
||||
</select>
|
||||
<select id="updatePassword" resultType="java.lang.String">
|
||||
update sys_user set password=#{password}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue