From 23632d13e58d02dca3ed281e2af1ac39a215123b Mon Sep 17 00:00:00 2001 From: haozq <1611483981@qq.com> Date: Sat, 7 Sep 2024 11:55:57 +0800 Subject: [PATCH] =?UTF-8?q?isc=E9=9B=86=E6=88=90=20=E5=BC=80=E5=8F=91?= =?UTF-8?q?=E5=8F=8A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../auth/controller/IscLoginController.java | 54 ++++++++++++++++++ .../auth/controller/TokenController.java | 55 ++++++++++++------- .../securitycontrol/auth/form/LoginBody.java | 23 ++++++++ .../auth/service/SysLoginService.java | 42 +++++++------- .../src/main/resources/bootstrap.yml | 24 +++++--- .../common/core/constant/Constant.java | 5 +- .../common/security/service/TokenService.java | 1 + .../src/main/resources/bootstrap.yml | 13 ++--- .../src/main/resources/bootstrap.yml | 13 ++--- .../controller/DeviceController.java | 1 + .../controller/ExportFileController.java | 2 +- .../controller/TodayTaskController.java | 5 +- .../background/mapper/HumanManageMapper.java | 7 +++ .../background/mapper/VehicleMapper.java | 7 +++ .../background/service/ITodayTaskService.java | 5 +- .../service/impl/HumanServiceImpl.java | 48 ++++++++-------- .../service/impl/TbAreaServiceImpl.java | 2 +- .../service/impl/TodayTaskServiceImpl.java | 40 +++++++++++++- .../service/impl/VehicleServiceImpl.java | 47 +++++++++------- .../src/main/resources/bootstrap.yml | 8 +-- .../resources/mapper/HumanManageMapper.xml | 10 ++++ .../main/resources/mapper/VehicleMapper.xml | 12 +++- .../src/main/resources/bootstrap.yml | 11 ++-- .../screen/VscScreenApplication.java | 4 +- .../screen/mapper/AccessMgeMapper.java | 13 +++++ .../service/impl/AccessMgeServiceImpl.java | 20 ++++--- .../src/main/resources/bootstrap.yml | 10 ++-- .../main/resources/mapper/AccessMgeMapper.xml | 46 ++++++++++++++-- .../src/main/resources/bootstrap.yml | 8 +-- 29 files changed, 388 insertions(+), 148 deletions(-) create mode 100644 securitycontrol-auth/src/main/java/com/securitycontrol/auth/controller/IscLoginController.java diff --git a/securitycontrol-auth/src/main/java/com/securitycontrol/auth/controller/IscLoginController.java b/securitycontrol-auth/src/main/java/com/securitycontrol/auth/controller/IscLoginController.java new file mode 100644 index 0000000..98e5f3e --- /dev/null +++ b/securitycontrol-auth/src/main/java/com/securitycontrol/auth/controller/IscLoginController.java @@ -0,0 +1,54 @@ +package com.securitycontrol.auth.controller; + +import com.alibaba.fastjson.JSONObject; +import com.google.common.collect.Maps; +import com.securitycontrol.auth.form.IscUserInfo; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.client.ResourceAccessException; +import org.springframework.web.client.RestTemplate; + +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.Map; + +public class IscLoginController { + + + + + public static Map getUserTicket(String url,String ticket, String model, String accessToken,String loginIndex) { + Map map= Maps.newHashMap(); + System.out.println("走了ticket=="+ticket); + IscUserInfo user = null; + try { + String userInfo = ""; + if (model.equals("xn")) { + userInfo = (new RestTemplate()).getForObject(url + "/serviceValidate" + "?" + "ticket" + "=" + ticket + "&service=" + loginIndex, String.class, new Object[0]); + System.out.println("--------------------------------------------------------------------------------"+userInfo.toString()); + } else { + userInfo = (new RestTemplate()).getForObject(url + "/oauth2.0/profile" + "?" + "access_token" + "=" + accessToken, String.class, new Object[0]); + } + if (userInfo.contains("authenticationFailure") || userInfo.contains("error")) { + throw new RuntimeException("ticket或accessToken不正确,请重新校验其可用性"); + } else { + String cd = URLDecoder.decode(userInfo, "UTF-8"); + if (model.equals("xn")) { + cd = cd.substring(cd.indexOf(""), cd.indexOf("")); + cd = cd.replace("", ""); + } + user = JSONObject.parseObject(cd, IscUserInfo.class); + // 用户校验 + map.put("password","Bonus@admin123"); + map.put("username",user.getIscAdCode()); + map.put("iscUserId",user.getIscUserId()); + map.put("nickName",user.getName()); + //验证用户 + } + } catch (ResourceAccessException | UnsupportedEncodingException var5) { + map.put("msg","用户登录异常"); + throw new RuntimeException("ISC CAS 认证服务连接失败,无法获取用户信息", var5); + } + return map; + } + +} diff --git a/securitycontrol-auth/src/main/java/com/securitycontrol/auth/controller/TokenController.java b/securitycontrol-auth/src/main/java/com/securitycontrol/auth/controller/TokenController.java index 03f2405..d007eae 100644 --- a/securitycontrol-auth/src/main/java/com/securitycontrol/auth/controller/TokenController.java +++ b/securitycontrol-auth/src/main/java/com/securitycontrol/auth/controller/TokenController.java @@ -63,40 +63,55 @@ public class TokenController { private TokenService tokenService; @Resource private RedisService redisUtil; - public static String NULL_STRING="null"; - @Autowired private SysLoginService sysLoginService; @Autowired private SysRecordLogService recordLogService; - @Value("${isc.appId}") - private String appId; + /** + * 省侧施工大屏 + */ + @Value("${isc.sc_web_index}") + public String sc_web_index; + /** + * 后台 + */ + @Value("${isc.ht_index}") + public String ht_index; + /** + * 施工 + */ + @Value("${isc.sg_wb_index}") + public String sg_wb_index; + + @Value("${isc.url}") + public String url; @PostMapping("login") public Result login(@RequestBody LoginBody form) { - - +// String logType=form.getLoginType(); +// Map map; +// if("1".equals(logType)){ +// map=IscLoginController.getUserTicket(url,form.getTicket(),"xn",form.getAccessToken(),sc_web_index); +// }else if("2".equals(logType)){ +// map=IscLoginController.getUserTicket(url,form.getTicket(),"xn",form.getAccessToken(),sc_web_index); +// }else{ +// map=IscLoginController.getUserTicket(url,form.getTicket(),"xn",form.getAccessToken(),ht_index); +// } +// String username=map.get("username"); +// System.err.println("username="+username); +// String password=map.get("password"); +// System.err.println("password="+password); +// String iscUserId=map.get("iscUserId"); +// System.err.println("iscUserId="+iscUserId); LoginUser userInfo2 = sysLoginService.login(form.getUsername(),form.getPassword(), form.getLoginType(), null); // 获取登录token + // userInfo2.setIscUserId(iscUserId); return Result.ok(tokenService.createToken(userInfo2), "登录成功"); -// 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(userInfo2), "登录成功"); -// } -// Map map=getIscLogin(form.getUsername(), form.getPassword()); -// iscLogin(form.getUsername(), form.getPassword()); -// List 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 getIscLogin(String username, String password) { diff --git a/securitycontrol-auth/src/main/java/com/securitycontrol/auth/form/LoginBody.java b/securitycontrol-auth/src/main/java/com/securitycontrol/auth/form/LoginBody.java index 7e8f8e8..2686f0e 100644 --- a/securitycontrol-auth/src/main/java/com/securitycontrol/auth/form/LoginBody.java +++ b/securitycontrol-auth/src/main/java/com/securitycontrol/auth/form/LoginBody.java @@ -13,14 +13,29 @@ public class LoginBody{ */ private String username; + /** + * 票据 + */ + private String ticket; + /** * 用户密码 */ private String password; + private String accessToken; + @ApiModelProperty("1.省侧大屏 2.施工现场大屏 3.app") private String loginType; + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + public String getUsername() { return username; @@ -48,4 +63,12 @@ public class LoginBody{ public void setLoginType(String loginType) { this.loginType = loginType; } + + public String getTicket() { + return ticket; + } + + public void setTicket(String ticket) { + this.ticket = ticket; + } } diff --git a/securitycontrol-auth/src/main/java/com/securitycontrol/auth/service/SysLoginService.java b/securitycontrol-auth/src/main/java/com/securitycontrol/auth/service/SysLoginService.java index f915da2..000d6c1 100644 --- a/securitycontrol-auth/src/main/java/com/securitycontrol/auth/service/SysLoginService.java +++ b/securitycontrol-auth/src/main/java/com/securitycontrol/auth/service/SysLoginService.java @@ -90,27 +90,27 @@ public class SysLoginService recordLogService.recordLogininfor(username,null,"用户登录","对不起,您的账号:" + username + " 已锁定",1,0,"{'username':'"+username+"'",startTime); throw new ServiceException("对不起,您的账号:" + username + " 已锁定",201); } - if(StringHelper.isEmpty(loginType)){ - if(!user.getLoginType().contains(Constant.BACK_LOGIN)){ - recordLogService.recordLogininfor(username,null,"用户登录","无登录后台权限",1,0,"{'username':'"+username+"'",startTime); - throw new ServiceException("对不起,您的账号:" + username + " 无登录后台权限",201); - } - }else if(Constant.SC_SCREEN.equals(loginType)){ - if(!user.getLoginType().contains(Constant.SC_SCREEN)){ - recordLogService.recordLogininfor(username,null,"省侧大屏用户登录","无登录省侧大屏权限",1,0,"{'username':'"+username+"'",startTime); - throw new ServiceException("对不起,您的账号:" + username + " 无登录省侧大屏权限",201); - } - }else if(Constant.SG_SCREEN.equals(loginType)){ - if(!user.getLoginType().contains(Constant.SG_SCREEN)){ - recordLogService.recordLogininfor(username,null,"施工大屏用户登录","无登录施工大屏权限",1,0,"{'username':'"+username+"'",startTime); - throw new ServiceException("对不起,您的账号:" + username + " 无登录施工大屏权限",201); - } - }else if(Constant.APP_LOGIN.equals(loginType)){ - if(!user.getLoginType().contains(Constant.APP_LOGIN)){ - recordLogService.recordLogininfor(username,null,"APP用户登录","无登录APP权限",1,0,"{'username':'"+username+"'",startTime); - throw new ServiceException("对不起,您的账号:" + username + " 无登录APP权限",201); - } - } +// if(StringHelper.isEmpty(loginType)){ +// if(!user.getLoginType().contains(Constant.BACK_LOGIN)){ +// recordLogService.recordLogininfor(username,null,"用户登录","无登录后台权限",1,0,"{'username':'"+username+"'",startTime); +// throw new ServiceException("对不起,您的账号:" + username + " 无登录后台权限",201); +// } +// }else if(Constant.SC_SCREEN.equals(loginType)){ +// if(!user.getLoginType().contains(Constant.SC_SCREEN)){ +// recordLogService.recordLogininfor(username,null,"省侧大屏用户登录","无登录省侧大屏权限",1,0,"{'username':'"+username+"'",startTime); +// throw new ServiceException("对不起,您的账号:" + username + " 无登录省侧大屏权限",201); +// } +// }else if(Constant.SG_SCREEN.equals(loginType)){ +// if(!user.getLoginType().contains(Constant.SG_SCREEN)){ +// recordLogService.recordLogininfor(username,null,"施工大屏用户登录","无登录施工大屏权限",1,0,"{'username':'"+username+"'",startTime); +// throw new ServiceException("对不起,您的账号:" + username + " 无登录施工大屏权限",201); +// } +// }else if(Constant.APP_LOGIN.equals(loginType)){ +// if(!user.getLoginType().contains(Constant.APP_LOGIN)){ +// recordLogService.recordLogininfor(username,null,"APP用户登录","无登录APP权限",1,0,"{'username':'"+username+"'",startTime); +// throw new ServiceException("对不起,您的账号:" + username + " 无登录APP权限",201); +// } +// } passwordService.validate(user, password); if(ListHelper.isEmpty(list)){ Result> menu = remoteUserService.getAllMenuList(user.getUserId()+"", SecurityConstants.INNER); diff --git a/securitycontrol-auth/src/main/resources/bootstrap.yml b/securitycontrol-auth/src/main/resources/bootstrap.yml index 4edd87f..25972e7 100644 --- a/securitycontrol-auth/src/main/resources/bootstrap.yml +++ b/securitycontrol-auth/src/main/resources/bootstrap.yml @@ -14,16 +14,16 @@ spring: active: dev cloud: nacos: + username: nacos + password: Jjsp@nacos2023 discovery: - username: nacos - password: Jjsp@nacos2023 - namespace: jjzhgd # 服务注册地址 + #server-addr: 27.50.49.56:21625 server-addr: 127.0.0.1:8848 - config: - username: nacos - password: Jjsp@nacos2023 namespace: jjzhgd + config: + namespace: jjzhgd + #server-addr: 27.50.49.56:21625 server-addr: 127.0.0.1:8848 # 配置文件格式 file-extension: yml @@ -34,6 +34,16 @@ spring: jasypt: encryptor: password: Encrypt +#isc: +# appId: 9bb295b78f95350d018fc23d3f284f1f +# url: 10.138.107.32:17002/isc_frontmv_serv/userLoginAuth isc: + url: http://iscssotest.ah.sgcc.com.cn/isc_sso + #省侧大屏首页 + sc_web_index: http://27.50.49.56:21624/zhgd-web/scIndex.html + #施工大屏首页 + sg_wb_index: http://27.50.49.56:21624/zhgd-web/sgIndex.html + #后台shouted + ht_index: http://27.50.49.56:21624/zhgd-ht/#/ywgllogin appId: 9bb295b78f95350d018fc23d3f284f1f - url: 10.138.107.32:17002/isc_frontmv_serv/userLoginAuth + dateUrl: http://10.212.209.109/isc_mp/ diff --git a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/constant/Constant.java b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/constant/Constant.java index 9125003..2b2b404 100644 --- a/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/constant/Constant.java +++ b/securitycontrol-commons/securitycontrol-commons-core/src/main/java/com/securitycontrol/common/core/constant/Constant.java @@ -77,7 +77,7 @@ public class Constant { /**人员闸机编码*/ public final static String PERSON_CAR_TYPE = "1907"; /**车辆闸机编码*/ - public final static String CAR_GATE = "1911"; + public final static String CAR_GATE = "1907"; /**人员闸机检测名称*/ public final static String PERSON = "绑定人"; public final static String CAR = "车牌号"; @@ -85,7 +85,10 @@ public class Constant { public final static String ACCESS_TIME = "出入时间"; public final static String ACCESS_TYPE = "出入类型"; public final static String ACCESS_TYPE_IN = "入"; + + public final static String ACCESS_TYPE_IN2 = "入"; public final static String ACCESS_TYPE_OUT = "出"; + public final static String ACCESS_TYPE_OUT2 = "出"; public final static String TYPE = "1"; /**安全帽*/ public final static String AQM = "1804"; diff --git a/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/service/TokenService.java b/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/service/TokenService.java index fbfbabb..7641062 100644 --- a/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/service/TokenService.java +++ b/securitycontrol-commons/securitycontrol-commons-security/src/main/java/com/securitycontrol/common/security/service/TokenService.java @@ -65,6 +65,7 @@ public class TokenService { Map rspMap = new HashMap(50); String jwtToken=JwtUtils.createToken(claimsMap); rspMap.put("access_token", jwtToken); + rspMap.put("iscUserId", loginUser.getIscUserId()); rspMap.put("us", JSON.toJSONString(loginUser.getSysUser())); int time=60*120; redisService.set("token:"+jwtToken,jwtToken,time); diff --git a/securitycontrol-gateway/src/main/resources/bootstrap.yml b/securitycontrol-gateway/src/main/resources/bootstrap.yml index 46fe55f..e7e9db5 100644 --- a/securitycontrol-gateway/src/main/resources/bootstrap.yml +++ b/securitycontrol-gateway/src/main/resources/bootstrap.yml @@ -15,25 +15,24 @@ spring: active: dev cloud: nacos: + username: nacos + password: Jjsp@nacos2023 discovery: - username: nacos - password: Jjsp@nacos2023 - namespace: jjzhgd # 服务注册地址 + # server-addr: 27.50.49.56:18848 server-addr: 127.0.0.1:8848 - # server-addr: 10.138.225.186:28848 + namespace: jjzhgd config: # 配置中心地址 + # server-addr: 27.50.49.56:18848 server-addr: 127.0.0.1:8848 + namespace: jjzhgd # 配置文件格式 file-extension: yml #server-addr: 10.145.34.32:8848 # 共享配置 shared-configs: - vsc-dev.yml - username: nacos - password: Jjsp@nacos2023 - namespace: jjzhgd # server-addr: 10.138.132.188:18848 management: server: diff --git a/securitycontrol-model/securitycontrol-Interface/src/main/resources/bootstrap.yml b/securitycontrol-model/securitycontrol-Interface/src/main/resources/bootstrap.yml index 4e13a8b..9811927 100644 --- a/securitycontrol-model/securitycontrol-Interface/src/main/resources/bootstrap.yml +++ b/securitycontrol-model/securitycontrol-Interface/src/main/resources/bootstrap.yml @@ -17,16 +17,13 @@ spring: active: dev cloud: nacos: + username: nacos + password: Jjsp@nacos2023 + namespace: jjzhgd discovery: - username: nacos - password: Jjsp@nacos2023 - server-addr: 127.0.0.1:8848 - namespace: jjzhgd + server-addr: 27.50.49.56:21625 config: - username: nacos - password: Jjsp@nacos2023 - namespace: jjzhgd - server-addr: 127.0.0.1:8848 + server-addr: 27.50.49.56:21625 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/DeviceController.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/DeviceController.java index 3231950..23e5dea 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/DeviceController.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/DeviceController.java @@ -1,5 +1,6 @@ package com.securitycontrol.background.controller; +import com.github.pagehelper.PageInfo; import com.securitycontrol.background.service.DeviceService; import com.securitycontrol.common.core.domain.Result; import com.securitycontrol.common.core.web.controller.BaseController; diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/ExportFileController.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/ExportFileController.java index 974d227..f228a7f 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/ExportFileController.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/ExportFileController.java @@ -182,7 +182,7 @@ public class ExportFileController { public void exportTodayTaskData(HttpServletRequest request, HttpServletResponse response, TodayTaskDto dto) { try { List todayTaskExportVoList = new ArrayList<>(); - List todayTaskVoList = iTodayTaskService.getToDayTaskLists(dto); + List todayTaskVoList = iTodayTaskService.getToDayTaskListsExport(dto); for (int i = 0; i < todayTaskVoList.size(); i++) { todayTaskVoList.get(i).setClassId((i + 1) + ""); TodayTaskExportVo todayTaskExportVo = new TodayTaskExportVo(); diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/TodayTaskController.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/TodayTaskController.java index b6be9a2..e7fdd65 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/TodayTaskController.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/controller/TodayTaskController.java @@ -1,5 +1,6 @@ package com.securitycontrol.background.controller; +import com.github.pagehelper.PageInfo; import com.securitycontrol.background.service.ITodayTaskService; import com.securitycontrol.common.core.web.controller.BaseController; import com.securitycontrol.common.core.web.domain.AjaxResult; @@ -7,6 +8,7 @@ import com.securitycontrol.common.core.web.page.TableDataInfo; import com.securitycontrol.common.log.annotation.Log; import com.securitycontrol.common.log.enums.OperationType; import com.securitycontrol.entity.background.dto.TodayTaskDto; +import com.securitycontrol.entity.background.vo.DeviceVo; import com.securitycontrol.entity.background.vo.TodayTaskVo; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.GetMapping; @@ -34,8 +36,7 @@ public class TodayTaskController extends BaseController { @Log(title = "风险值班管理", menu = "风险值班管理->当日任务", grade = OperationType.QUERY_BUSINESS, details = "查询班组", type = "业务日志") public TableDataInfo getToDayTaskLists(TodayTaskDto dto) { startPage(); - List list = service.getToDayTaskLists(dto); - return getDataTable(list); + return service.getToDayTaskLists(dto); } @ApiOperation(value = "远程巡视详情") diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/HumanManageMapper.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/HumanManageMapper.java index 13b3515..931f6da 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/HumanManageMapper.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/HumanManageMapper.java @@ -200,4 +200,11 @@ public interface HumanManageMapper { * @date 2024/4/19 16:01 */ String getUserBingCup(@Param("params") HumanManageVo vo,@Param("typeCode")String typeCode); + + /** + * 人员进出记录 + * @param dto + * @return + */ + List getUserAccessList(ParamDto dto); } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/VehicleMapper.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/VehicleMapper.java index 447a5d9..60e5279 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/VehicleMapper.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/mapper/VehicleMapper.java @@ -60,4 +60,11 @@ public interface VehicleMapper { * @date 2024/4/18 11:00 */ String getCarAccessLists(String value); + + /** + * 车辆荆楚记录 + * @param dto + * @return + */ + List getCardAccess(VehicleVo dto); } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/ITodayTaskService.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/ITodayTaskService.java index 85ad996..3aceb3f 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/ITodayTaskService.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/ITodayTaskService.java @@ -1,6 +1,7 @@ package com.securitycontrol.background.service; import com.securitycontrol.common.core.web.domain.AjaxResult; +import com.securitycontrol.common.core.web.page.TableDataInfo; import com.securitycontrol.entity.background.dto.TodayTaskDto; import com.securitycontrol.entity.background.vo.TodayTaskVo; @@ -22,7 +23,7 @@ public interface ITodayTaskService { * @author cwchen * @date 2024/3/23 13:21 */ - List getToDayTaskLists(TodayTaskDto dto); + TableDataInfo getToDayTaskLists(TodayTaskDto dto); /** * 远程巡视详情 @@ -44,4 +45,6 @@ public interface ITodayTaskService { * @date 2024/3/23 16:40 */ AjaxResult getBallTimeList(TodayTaskDto dto); + + List getToDayTaskListsExport(TodayTaskDto dto); } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java index 815c8e8..f2b424d 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/HumanServiceImpl.java @@ -266,29 +266,31 @@ public class HumanServiceImpl implements HumanService { @Override public List getPersonnelAccessLists(ParamDto dto) { List list = new ArrayList<>(); - try { - dto.setTypeCode(Constant.PERSON_CAR_TYPE); - dto.setModeName(Constant.PERSON); - UserAccessVo userDetail = mapper.getUserDeatail(dto); - String decryptIdNumber = AesCbcUtils.decrypt(userDetail.getIdNumber()); - if(decryptIdNumber != null){ - userDetail.setIdNumber(decryptIdNumber); - } - list = mapper.getPersonnelAccessLists(dto); - for (UserAccessVo vo : list) { - String value = vo.getValue(); - vo.setIdNumber(userDetail.getIdNumber()); - vo.setUserPhone(userDetail.getUserPhone()); - vo.setUserName(userDetail.getUserName()); - String data = mapper.getUserAccessLists(value); - if(StringUtils.isNotEmpty(data)){ - String[] dataArr = data.split(","); - setUserAccessData(vo,dataArr); - } - } - } catch (Exception e) { - log.error(e.toString(),e); - } + + list=mapper.getUserAccessList(dto); +// try { +// dto.setTypeCode(Constant.PERSON_CAR_TYPE); +// dto.setModeName(Constant.PERSON); +// UserAccessVo userDetail = mapper.getUserDeatail(dto); +// String decryptIdNumber = AesCbcUtils.decrypt(userDetail.getIdNumber()); +// if(decryptIdNumber != null){ +// userDetail.setIdNumber(decryptIdNumber); +// } +// list = mapper.getPersonnelAccessLists(dto); +// for (UserAccessVo vo : list) { +// String value = vo.getValue(); +// vo.setIdNumber(userDetail.getIdNumber()); +// vo.setUserPhone(userDetail.getUserPhone()); +// vo.setUserName(userDetail.getUserName()); +// String data = mapper.getUserAccessLists(value); +// if(StringUtils.isNotEmpty(data)){ +// String[] dataArr = data.split(","); +// setUserAccessData(vo,dataArr); +// } +// } +// } catch (Exception e) { +// log.error(e.toString(),e); +// } return list; } diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TbAreaServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TbAreaServiceImpl.java index 623b617..dae2027 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TbAreaServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TbAreaServiceImpl.java @@ -292,7 +292,7 @@ public class TbAreaServiceImpl implements TbAreaService { Result result1 = remoteFileService.mostUploadFile(files,SecurityConstants.INNER); if(result1.getCode()!=SystemGlobal.SUCCESS_CODE){ mapper.deleteData(dto); - Result.fail("文件服务未连接,文件上传失败"); + return Result.fail("文件服务未连接,文件上传失败"); } List list= (List) result1.getData(); Result result2= sourceFileService.addSourceList(list, dto.getId(),"三维文件","0"); diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TodayTaskServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TodayTaskServiceImpl.java index a91071e..3fca837 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TodayTaskServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/TodayTaskServiceImpl.java @@ -1,10 +1,13 @@ package com.securitycontrol.background.service.impl; +import com.github.pagehelper.PageInfo; import com.securitycontrol.background.mapper.ITodayTaskMapper; import com.securitycontrol.background.service.ITodayTaskService; +import com.securitycontrol.common.core.constant.HttpStatus; import com.securitycontrol.common.core.utils.aes.DateTimeHelper; import com.securitycontrol.common.core.utils.aes.StringHelper; import com.securitycontrol.common.core.web.domain.AjaxResult; +import com.securitycontrol.common.core.web.page.TableDataInfo; import com.securitycontrol.entity.background.dto.TodayTaskDto; import com.securitycontrol.entity.background.vo.DeviceUpDownVo; import com.securitycontrol.entity.background.vo.TodayTaskVo; @@ -35,7 +38,42 @@ public class TodayTaskServiceImpl implements ITodayTaskService { private ThreadPoolTaskExecutor testTaskExecutor; @Override - public List getToDayTaskLists(TodayTaskDto dto) { + public TableDataInfo getToDayTaskLists(TodayTaskDto dto) { + // 多线程执行操作,存放的数据集合 + List list = new ArrayList<>(); + List futureList = new ArrayList<>(); + List newList = new ArrayList<>(); + try { + dto = handleParams(dto); + list = mapper.getToDayTaskLists(dto); + for (TodayTaskVo todayTaskVo : list) { + Future future = testTaskExecutor.submit(new Callable() { + @Override + public TodayTaskVo call() throws Exception { + // 查询督查人 + String checkUserName = mapper.getCheckUser(todayTaskVo.getCheckUserId()); + todayTaskVo.setCheckUserName(checkUserName); + return todayTaskVo; + } + }); + futureList.add(future); + } + for (Future future : futureList) { + TodayTaskVo todayTaskVo = future.get(); + newList.add(todayTaskVo); + } + } catch (Exception e) { + log.error("获取当日任务列表", e); + } + TableDataInfo rspData = new TableDataInfo(); + rspData.setCode(HttpStatus.SUCCESS); + rspData.setRows(newList); + rspData.setMsg("查询成功"); + rspData.setTotal(new PageInfo(list).getTotal()); + return rspData; + } + @Override + public List getToDayTaskListsExport(TodayTaskDto dto) { // 多线程执行操作,存放的数据集合 List futureList = new ArrayList<>(); List newList = new ArrayList<>(); diff --git a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/VehicleServiceImpl.java b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/VehicleServiceImpl.java index 2d4c5ce..9f36d48 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/VehicleServiceImpl.java +++ b/securitycontrol-model/securitycontrol-background/src/main/java/com/securitycontrol/background/service/impl/VehicleServiceImpl.java @@ -95,28 +95,33 @@ public class VehicleServiceImpl implements VehicleService { @Override public List getLists(VehicleVo dto) { + List list = new ArrayList<>(); - String date = dto.getDate(); - if (!StringUtils.isEmpty(date)) { - String[] arr = date.split("@"); - dto.setStartDate(arr[0]); - dto.setEndDate(arr[1]); - } - try { - dto.setTypeCode(Constant.CAR_GATE); - dto.setModeName(Constant.CAR); - list = mapper.getLists(dto); - for (VehicleVo vo : list) { - String value = vo.getValue(); - String data = mapper.getCarAccessLists(value); - if(StringUtils.isNotEmpty(data)){ - String[] dataArr = data.split(","); - setCarAccessData(vo,dataArr); - } - } - } catch (Exception e) { - log.error("获取进出场记录列表",e); - } + list=mapper.getCardAccess(dto); + + +// List list = new ArrayList<>(); +// String date = dto.getDate(); +// if (!StringUtils.isEmpty(date)) { +// String[] arr = date.split("@"); +// dto.setStartDate(arr[0]); +// dto.setEndDate(arr[1]); +// } +// try { +// dto.setTypeCode(Constant.CAR_GATE); +// dto.setModeName(Constant.CAR); +// list = mapper.getLists(dto); +// for (VehicleVo vo : list) { +// String value = vo.getValue(); +// String data = mapper.getCarAccessLists(value); +// if(StringUtils.isNotEmpty(data)){ +// String[] dataArr = data.split(","); +// setCarAccessData(vo,dataArr); +// } +// } +// } catch (Exception e) { +// log.error("获取进出场记录列表",e); +// } return list; } diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/bootstrap.yml b/securitycontrol-model/securitycontrol-background/src/main/resources/bootstrap.yml index 8657e65..dc0c490 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/resources/bootstrap.yml +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/bootstrap.yml @@ -17,16 +17,16 @@ spring: active: dev cloud: nacos: + username: nacos + password: Jjsp@nacos2023 discovery: + # server-addr: 27.50.49.56:18848 server-addr: 127.0.0.1:8848 namespace: jjzhgd - username: nacos - password: ENC(xLup+kLqCG2IPXSawqFfeqJAy3BwMz/ElXZNia2uutPwbjfjEUrhqyO4RRV6TAob) config: + # server-addr: 27.50.49.56:18848 server-addr: 127.0.0.1:8848 namespace: jjzhgd - username: nacos - password: ENC(xLup+kLqCG2IPXSawqFfeqJAy3BwMz/ElXZNia2uutPwbjfjEUrhqyO4RRV6TAob) # 配置文件格式 file-extension: yml # 共享配置 diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/HumanManageMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/HumanManageMapper.xml index 7a6ac16..205cfb1 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/HumanManageMapper.xml +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/HumanManageMapper.xml @@ -154,6 +154,15 @@ WHERE tbd.devic_type = #{typeCode} AND tdd.mode_name = #{modeName} AND tbd.del_flag = 0 + + \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/VehicleMapper.xml b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/VehicleMapper.xml index 02c870e..4d11912 100644 --- a/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/VehicleMapper.xml +++ b/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/VehicleMapper.xml @@ -20,6 +20,7 @@ - + + diff --git a/securitycontrol-model/securitycontrol-files/src/main/resources/bootstrap.yml b/securitycontrol-model/securitycontrol-files/src/main/resources/bootstrap.yml index 79071b4..54adc4c 100644 --- a/securitycontrol-model/securitycontrol-files/src/main/resources/bootstrap.yml +++ b/securitycontrol-model/securitycontrol-files/src/main/resources/bootstrap.yml @@ -16,16 +16,15 @@ spring: active: dev cloud: nacos: + namespace: jjzhgd + username: nacos + password: Jjsp@nacos2023 discovery: server-addr: 127.0.0.1:8848 - namespace: jjzhgd - username: nacos - password: Jjsp@nacos2023 + # server-addr: 27.50.49.56:21625 config: server-addr: 127.0.0.1:8848 - namespace: jjzhgd - username: nacos - password: Jjsp@nacos2023 + # server-addr: 27.50.49.56:21625 # 配置文件格式 file-extension: yml # 共享配置 diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/VscScreenApplication.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/VscScreenApplication.java index 194450c..8e0cf8e 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/VscScreenApplication.java +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/VscScreenApplication.java @@ -37,12 +37,12 @@ public class VscScreenApplication implements CommandLineRunner { @Resource private StringEncryptor encryptor; - @Autowired - private ApplicationContext applicationContext; @Override public void run(String... args) throws Exception { String nacos = encrypt("Jjsp@nacos2023" ); + String mysql = encrypt("bonus@admin123" ); String mogodb = encrypt("Bonus@admin123!" ); + System.out.println( "mysql原始明文密码加密后的结果为:" + mysql ); System.out.println( "nacos原始明文密码加密后的结果为:" + nacos ); System.out.println( "mogodb原始明文密码加密后的结果为:" + mogodb ); diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/AccessMgeMapper.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/AccessMgeMapper.java index 9b35667..c020b0c 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/AccessMgeMapper.java +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/mapper/AccessMgeMapper.java @@ -47,4 +47,17 @@ public interface AccessMgeMapper { */ List getPerStatisticsList(AccessMgeDto dto); + /** + * 查询车辆下拉选 + * @param dto + * @return + */ + List getCardList(AccessMgeDto dto); + + /** + * 人员出入记录 + * @param dto + * @return + */ + List getUserList(AccessMgeDto dto); } diff --git a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/AccessMgeServiceImpl.java b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/AccessMgeServiceImpl.java index 87507f2..9a1ab8b 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/AccessMgeServiceImpl.java +++ b/securitycontrol-model/securitycontrol-screen/src/main/java/com/securitycontrol/screen/service/impl/AccessMgeServiceImpl.java @@ -176,13 +176,16 @@ public class AccessMgeServiceImpl implements AccessMgeService { // type : 1.车辆 2.人员 List list = new ArrayList<>(); try { - dto.setTypeCode(Objects.equals(Constant.TYPE, type) ? Constant.CAR_GATE : Constant.PERSON_CAR_TYPE); - dto.setModeName(Objects.equals(Constant.TYPE, type) ? Constant.CAR : Constant.PERSON); - if (StringHelper.isEmpty(dto.getStartDate())) { - dto.setStartDate(DateTimeHelper.getNowDate()); - dto.setEndDate(DateTimeHelper.getNowDate()); - } - list = Objects.equals(Constant.TYPE, type) ? mapper.getVehicleStatisticsList(dto) : mapper.getPerStatisticsList(dto); + +// dto.setTypeCode(Objects.equals(Constant.TYPE, type) ? Constant.CAR_GATE : Constant.PERSON_CAR_TYPE); +// dto.setModeName(Objects.equals(Constant.TYPE, type) ? Constant.CAR : Constant.PERSON); +// if (StringHelper.isEmpty(dto.getStartDate())) { +// dto.setStartDate(DateTimeHelper.getNowDate()); +// dto.setEndDate(DateTimeHelper.getNowDate()); +// } +// list = Objects.equals(Constant.TYPE, type) ? mapper.getVehicleStatisticsList(dto) : mapper.getPerStatisticsList(dto); + + list = Objects.equals(Constant.TYPE, type) ? mapper.getCardList(dto) : mapper.getUserList(dto); } catch (Exception e) { log.error(Objects.equals(Constant.TYPE, type) ? "获取车辆出入场记录" : "获取人员出入场记录", e); } @@ -201,7 +204,8 @@ public class AccessMgeServiceImpl implements AccessMgeService { dto.setStartDate(dateArr[0]); dto.setEndDate(dateArr[1]); AccessMgeVo vo = new AccessMgeVo(); - list = Objects.equals(Constant.TYPE, type) ? mapper.getVehicleStatisticsList(dto) : mapper.getPerStatisticsList(dto); + list = Objects.equals(Constant.TYPE, type) ? mapper.getCardList(dto) : mapper.getUserList(dto); + // list = Objects.equals(Constant.TYPE, type) ? mapper.getVehicleStatisticsList(dto) : mapper.getPerStatisticsList(dto); // 今日入 今日出 当月入 当月出 int jtrNum = 0, jrcNum = 0, dyrNum = 0, dycNum = 0; for (AccessMgeVo mgeVo : list) { diff --git a/securitycontrol-model/securitycontrol-screen/src/main/resources/bootstrap.yml b/securitycontrol-model/securitycontrol-screen/src/main/resources/bootstrap.yml index ca3ca3a..1d3ce4c 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/resources/bootstrap.yml +++ b/securitycontrol-model/securitycontrol-screen/src/main/resources/bootstrap.yml @@ -17,17 +17,17 @@ spring: active: dev cloud: nacos: + username: nacos + password: ENC(WEXrSAwB34//rIMP9XgKly1MKnwitpClyMfZuVheQhyn3FwbNJXJ60M3N8Z6QlXr) discovery: + # server-addr: 27.50.49.56:21625 server-addr: 127.0.0.1:8848 namespace: jjzhgd - username: nacos - password: Jjsp@nacos2023 config: + # server-addr: 27.50.49.56:21625 server-addr: 127.0.0.1:8848 namespace: jjzhgd - username: nacos - password: Jjsp@nacos2023 - # 配置文件格式 + # 配置文件格式 file-extension: yml # 共享配置 shared-configs: diff --git a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/AccessMgeMapper.xml b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/AccessMgeMapper.xml index eee3902..1c33a84 100644 --- a/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/AccessMgeMapper.xml +++ b/securitycontrol-model/securitycontrol-screen/src/main/resources/mapper/AccessMgeMapper.xml @@ -21,7 +21,8 @@ @@ -87,7 +88,9 @@ + + \ No newline at end of file diff --git a/securitycontrol-model/securitycontrol-system/src/main/resources/bootstrap.yml b/securitycontrol-model/securitycontrol-system/src/main/resources/bootstrap.yml index 6dc6eba..1447903 100644 --- a/securitycontrol-model/securitycontrol-system/src/main/resources/bootstrap.yml +++ b/securitycontrol-model/securitycontrol-system/src/main/resources/bootstrap.yml @@ -17,15 +17,15 @@ spring: active: dev cloud: nacos: + username: nacos + password: Jjsp@nacos2023 discovery: + # server-addr: 27.50.49.56:21625 server-addr: 127.0.0.1:8848 - username: nacos - password: Jjsp@nacos2023 namespace: jjzhgd config: + # server-addr: 27.50.49.56:21625 server-addr: 127.0.0.1:8848 - username: nacos - password: Jjsp@nacos2023 namespace: jjzhgd # 配置文件格式 file-extension: yml