diff --git a/pom.xml b/pom.xml index 49fe047..59cc4a1 100644 --- a/pom.xml +++ b/pom.xml @@ -952,13 +952,13 @@ <!–CustomClassLoader;WisdomSiteApplication;LicenseUtil;MyBootJarLauncher;MyJarClassLoader–> --> - - + + #<!–加密打包之后pom.xml会被删除,不用担心在jar包里找到此密码–> com.zhgd,com.license application.yml,application.properties,application-dev.properties,application-test.properties org.spring @@ -972,7 +972,7 @@ - + --> diff --git a/src/main/java/com/zhgd/xmgl/async/AsyncAttendance.java b/src/main/java/com/zhgd/xmgl/async/AsyncAttendance.java index 3943fd8..6601c09 100644 --- a/src/main/java/com/zhgd/xmgl/async/AsyncAttendance.java +++ b/src/main/java/com/zhgd/xmgl/async/AsyncAttendance.java @@ -5,14 +5,15 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.zhgd.xmgl.modules.basicdata.entity.SystemDictData; +import com.zhgd.xmgl.modules.basicdata.service.ISystemDictDataService; +import com.zhgd.xmgl.modules.basicdata.vo.SystemUserSyncVo; import com.zhgd.xmgl.modules.wisdom.entity.AttendanceDev; import com.zhgd.xmgl.modules.wisdom.entity.AttendanceDevSync; -import com.zhgd.xmgl.modules.basicdata.entity.SystemDictData; import com.zhgd.xmgl.modules.wisdom.entity.WorkerInfo; import com.zhgd.xmgl.modules.wisdom.mapper.AttendanceDevMapper; import com.zhgd.xmgl.modules.wisdom.mapper.WorkerInfoMapper; import com.zhgd.xmgl.modules.wisdom.service.IAttendanceDevSyncService; -import com.zhgd.xmgl.modules.basicdata.service.ISystemDictDataService; import com.zhgd.xmgl.util.HttpUtil; import com.zhgd.xmgl.util.ParamEnum; import lombok.extern.slf4j.Slf4j; @@ -138,4 +139,27 @@ public class AsyncAttendance { attendanceDevSync.setCreateTime(new Date()); return attendanceDevSync; } + + + /** + * 同步用户信息 + * @param type + * @param systemUserSyncVo + */ + public String syncUser(Integer type, SystemUserSyncVo systemUserSyncVo) { + String requestUrl = buildRequestUrl(type, null); + if (requestUrl == null) { + return null; + } + try { + JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(systemUserSyncVo)); + // 推送同步信息 + String result = HttpUtil.doPost(requestUrl, jsonObject.toString()); + return result; + }catch (Exception e){ + e.printStackTrace(); + log.error("推送考勤设备数据出现异常,请求路径:" + requestUrl + ",设备ID:" + systemUserSyncVo.getUid()); + } + return null; + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/SystemUserOpController.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/SystemUserOpController.java index 76d22c1..945c71f 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/SystemUserOpController.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/admin/SystemUserOpController.java @@ -5,14 +5,8 @@ import com.zhgd.annotation.OperLog; import com.zhgd.jeecg.common.api.vo.Result; import com.zhgd.xmgl.handler.exception.CustomException; import com.zhgd.xmgl.modules.basicdata.dto.SystemUserDto; -import com.zhgd.xmgl.modules.basicdata.entity.Government; -import com.zhgd.xmgl.modules.basicdata.entity.SystemRole; -import com.zhgd.xmgl.modules.basicdata.entity.SystemUser; -import com.zhgd.xmgl.modules.basicdata.entity.SystemUserRole; -import com.zhgd.xmgl.modules.basicdata.service.IGovernmentService; -import com.zhgd.xmgl.modules.basicdata.service.ISystemRoleService; -import com.zhgd.xmgl.modules.basicdata.service.ISystemUserRoleService; -import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService; +import com.zhgd.xmgl.modules.basicdata.entity.*; +import com.zhgd.xmgl.modules.basicdata.service.*; import com.zhgd.xmgl.modules.basicdata.vo.SystemUserOpVo; import com.zhgd.xmgl.modules.basicdata.vo.SystemUserVo; import com.zhgd.xmgl.security.JwtTokenProvider; @@ -47,6 +41,9 @@ public class SystemUserOpController { @Autowired private ISystemUserService systemUserService; + @Autowired + private IEnterpriseService enterpriseService; + @Autowired private ISystemUserRoleService systemUserRoleService; @@ -68,17 +65,16 @@ public class SystemUserOpController { if (systemUser1 != null) { throw new CustomException("该用户账号已存在!请重新输入"); } - Government government = governmentService.list().get(0); SystemUser systemUser = new SystemUser(); systemUser.setUserId(systemUserOpVo.getId()); systemUser.setAccount(systemUserOpVo.getName()); systemUser.setPassword(systemUserOpVo.getPwd()); systemUser.setShowPassword(systemUserOpVo.getPwd()); systemUser.setCreateTime(new Date()); - systemUser.setSn(government.getGovernmentSn()); + systemUser.setSn(systemUserOpVo.getSn()); systemUser.setShowPassword(systemUser.getPassword()); systemUser.setIsManager(false); - systemUser.setAccountType(2); + systemUser.setAccountType(systemUserOpVo.getAccountType()); systemUser.setUserTel(systemUserOpVo.getNumPhone()); systemUser.setRealName(systemUserOpVo.getRealName()); systemUserService.save(systemUser); @@ -157,11 +153,11 @@ public class SystemUserOpController { @OperLog(operModul = "角色管理", operType = "列表查询", operDesc = "列表查询系统角色信息") @ApiOperation(value = " 列表查询系统角色信息", notes = "列表查询系统角色信息", httpMethod="GET") - @GetMapping(value = "/roleList") - public Result> roleList() { - Government government = governmentService.list().get(0); - List list = systemRoleService.list(Wrappers.lambdaQuery().eq(SystemRole::getSn, government.getGovernmentSn()) - .eq(SystemRole::getSysDefault, 0).gt(SystemRole::getPriority, 3)); + @PostMapping(value = "/roleList") + public Result> roleList(@RequestBody SystemRole systemRole) { + List list = systemRoleService.list(Wrappers.lambdaQuery() + .eq(SystemRole::getSysDefault, 0) + .eq(SystemRole::getSn, systemRole.getSn())); return Result.success(list); } @@ -176,4 +172,20 @@ public class SystemUserOpController { result.setSuccess(true); return result; } + + @OperLog(operModul = "角色管理", operType = "列表查询", operDesc = "查询政务信息") + @ApiOperation(value = " 查询政务信息", notes = "查询政务信息", httpMethod="GET") + @GetMapping(value = "/government") + public Result government() { + return Result.success(governmentService.list().get(0)); + } + + @OperLog(operModul = "角色管理", operType = "列表查询", operDesc = "获取企业列表信息") + @ApiOperation(value = " 获取企业列表信息", notes = "获取企业列表信息", httpMethod="GET") + @GetMapping(value = "/enterpriseList") + public Result> enterpriseList() { + List list = enterpriseService.list(Wrappers.lambdaQuery() + .eq(Enterprise::getState, 1)); + return Result.success(list); + } } diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/government/GovEnterpriseController.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/government/GovEnterpriseController.java index 40d66c0..16a470c 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/government/GovEnterpriseController.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/controller/government/GovEnterpriseController.java @@ -72,7 +72,11 @@ public class GovEnterpriseController { @PostMapping(value = "/list") public Result> queryPageList(@RequestBody Enterprise enterprise) { SecurityUser user = SecurityUtil.getUser(); - enterprise.setGovernmentSn(user.getSn()); + if (user.getAccountType() == 3) { + user = null; + } else { + enterprise.setGovernmentSn(user.getSn()); + } QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(enterprise); List list = enterpriseService.list(queryWrapper); return Result.success(list); diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/SystemUser.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/SystemUser.java index 3572748..ae1d1b8 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/SystemUser.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/entity/SystemUser.java @@ -42,7 +42,7 @@ public class SystemUser implements Serializable { /** * 登录密码 */ - @NotBlank(message = "密码不能为空", groups = {AddGroup.class, EditGroup.class}) +// @NotBlank(message = "密码不能为空", groups = {AddGroup.class, EditGroup.class}) @Excel(name = "登录密码", width = 15) @ApiModelProperty(value = "登录密码") private String password; diff --git a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/SystemRoleServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/SystemRoleServiceImpl.java index a367d62..59693e3 100644 --- a/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/SystemRoleServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/basicdata/service/impl/SystemRoleServiceImpl.java @@ -11,9 +11,11 @@ import com.zhgd.xmgl.modules.basicdata.entity.SystemRole; import com.zhgd.xmgl.modules.basicdata.entity.SystemRoleMenu; import com.zhgd.xmgl.modules.basicdata.mapper.SystemRoleMapper; import com.zhgd.xmgl.modules.basicdata.mapper.SystemRoleMenuMapper; +import com.zhgd.xmgl.modules.basicdata.service.IGovernmentService; import com.zhgd.xmgl.modules.basicdata.service.ISystemRoleService; import com.zhgd.xmgl.security.SecurityUser; import com.zhgd.xmgl.security.SecurityUtil; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -35,11 +37,14 @@ public class SystemRoleServiceImpl extends ServiceImpl pageList(Map map) { SecurityUser user = SecurityUtil.getUser(); QueryWrapper queryWrapper = QueryGenerator.initPageQueryWrapper(SystemRole.class, map); - if (user.getAccountType() == 4) { + if (user.getAccountType() == 4 || (user.getAccountType() == 3 && !user.getEnterpriseMainList().contains(1))) { queryWrapper.eq("sn", user.getSn()); if (!user.isManager()) { queryWrapper.eq("create_by", user.getUserId()); @@ -54,7 +59,9 @@ public class SystemRoleServiceImpl extends ServiceImpl getList(SystemRole systemRole) { SecurityUser user = SecurityUtil.getUser(); - if (user.getAccountType() == 4) { + if (StringUtils.isNotBlank(systemRole.getSn())) { + systemRole.setSn(systemRole.getSn()); + } else { systemRole.setSn(user.getSn()); } QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(systemRole); @@ -71,7 +78,7 @@ public class SystemRoleServiceImpl extends ServiceImpl getPageList(Map map) { Page page = PageUtil.getPage(map); SecurityUser user = SecurityUtil.getUser(); QueryWrapper wrapper = QueryGenerator.initPageQueryWrapper(SystemUser.class, map); - if (user.getAccountType() == 4) { + if (user.getAccountType() == 4 || (user.getAccountType() == 3 && !user.getEnterpriseMainList().contains(1))) { wrapper.eq("u.sn", user.getSn()); if (!user.isManager()) { wrapper.eq("u.create_by", user.getUserId()); @@ -87,21 +100,44 @@ public class SystemUserServiceImpl extends ServiceImpl a.getActionCode()).collect(Collectors.toSet()); } } + List enterpriseMainList = new ArrayList<>(); + if (user.getAccountType() == 3) { + enterpriseMainList = enterpriseMainService.list(Wrappers.lambdaQuery().eq(EnterpriseMain::getEnterpriseSn, user.getSn())) + .stream().map(e -> e.getMainType()).collect(Collectors.toList()); + } Collection grantedAuthorityList = AuthorityUtils .createAuthorityList(actionCodes.toArray(new String[0])); return new SecurityUser(user.getUserId(), user.getAccount(), user.getRealName(), - user.getUserTel(), user.getAccountType(), user.getSn(), user.getIsManager(), /*user.getEngineeringSn(),*/ user.getShowPassword(), + user.getUserTel(), user.getAccountType(), user.getSn(), user.getIsManager(), enterpriseMainList, /*user.getEngineeringSn(),*/ user.getShowPassword(), true, true, true, false, grantedAuthorityList); diff --git a/src/main/java/com/zhgd/xmgl/security/SecurityUser.java b/src/main/java/com/zhgd/xmgl/security/SecurityUser.java index fe66503..8626033 100644 --- a/src/main/java/com/zhgd/xmgl/security/SecurityUser.java +++ b/src/main/java/com/zhgd/xmgl/security/SecurityUser.java @@ -9,6 +9,7 @@ import org.springframework.security.core.SpringSecurityCoreVersion; import org.springframework.security.core.userdetails.User; import java.util.Collection; +import java.util.List; /** * @author peng @@ -25,6 +26,13 @@ public class SecurityUser extends User { @Setter private String userId; + /** + * 用户登录名 + */ + @Getter + @Setter + private String account; + /** * 真实姓名 */ @@ -60,6 +68,13 @@ public class SecurityUser extends User { @Setter private boolean isManager; + /** + * 是否为管理员账号 + */ + @Getter + @Setter + private List enterpriseMainList; + /** * 是否为工程账号 */ @@ -71,7 +86,7 @@ public class SecurityUser extends User { public SecurityUser(@JsonProperty("userId") String userId, @JsonProperty("account") String account, @JsonProperty("realName")String realName, @JsonProperty("userTel") String userTel, @JsonProperty("accountType") Integer accountType, @JsonProperty("sn") String sn, - @JsonProperty("isManager") boolean isManager, /*@JsonProperty("engineeringSn") String engineeringSn,*/ + @JsonProperty("isManager") boolean isManager, @JsonProperty("enterpriseMainList") List enterpriseMainList, @JsonProperty("password") String password, @JsonProperty("enabled") boolean enabled, @JsonProperty("accountNonExpired") boolean accountNonExpired, @JsonProperty("credentialsNonExpired") boolean credentialsNonExpired, @@ -79,11 +94,13 @@ public class SecurityUser extends User { @JsonProperty("authorities") Collection authorities) { super(account, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities); this.userId = userId; + this.account = account; this.realName = realName; this.userTel = userTel; this.accountType = accountType; this.sn = sn; this.isManager = isManager; + this.enterpriseMainList = enterpriseMainList; // this.engineeringSn = engineeringSn; } diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 6acd831..be7ff04 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -54,18 +54,18 @@ spring.boot.admin.client.instance.name=dev #artemisConfig.host=182.101.141.23:18443 #artemisConfig.appKey=24017757 #artemisConfig.appSecret=VJz0FbzmE6drPQ7egsBi -artemisConfig.host=120.236.122.37:81 -artemisConfig.appKey=27543152 -artemisConfig.appSecret=Xyi1y9udD7dGFGsS9d9w +#artemisConfig.host=120.236.122.37:81 +#artemisConfig.appKey=27543152 +#artemisConfig.appSecret=Xyi1y9udD7dGFGsS9d9w #opencv截取视频画面文件地址 opencv.filePath=D://opencv// #虹软人脸识别 -arcsoft.appId=13eRvuSeQYts8Tqcrqy4yFyg7h6XQqdUGkjJuh9ct2E2 -arcsoft.sdkKey=GLc2xHQ7yAwNxrWctSgNgVqwYqMTbz9RKTWWHQNMdJPU -arcsoft.linux.sdkKey= -arcsoft.dllPath=D:/dll +#arcsoft.appId=13eRvuSeQYts8Tqcrqy4yFyg7h6XQqdUGkjJuh9ct2E2 +#arcsoft.sdkKey=GLc2xHQ7yAwNxrWctSgNgVqwYqMTbz9RKTWWHQNMdJPU +#arcsoft.linux.sdkKey= +#arcsoft.dllPath=D:/dll #配置web页面入口 magic-api.resource.location=D://data//magic-api