diff --git a/lib/EmergencyBaseLib/EmergencyCommonEntity/src/main/java/com/zdxt/domain/auth/User.java b/lib/EmergencyBaseLib/EmergencyCommonEntity/src/main/java/com/zdxt/domain/auth/User.java index 38e9fba6..2d452b75 100644 --- a/lib/EmergencyBaseLib/EmergencyCommonEntity/src/main/java/com/zdxt/domain/auth/User.java +++ b/lib/EmergencyBaseLib/EmergencyCommonEntity/src/main/java/com/zdxt/domain/auth/User.java @@ -1,693 +1,703 @@ -package com.zdxt.domain.auth; - - - -import com.zdxt.common.BaseDomain; -import com.zdxt.common.annotation.Excel; -import com.zdxt.common.annotation.Excels; -import org.apache.shiro.crypto.SecureRandomNumberGenerator; - -import javax.validation.constraints.Email; -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.Size; -import java.util.Arrays; -import java.util.Date; -import java.util.List; - -/** - * 用户对象 sys_user - * - * @author ruoyi - */ -public class User extends BaseDomain { - private static final long serialVersionUID = 1L; - - /** token */ - private String token; - - /** - * 用户ID - */ - @Excel(name = "用户序号", cellType = Excel.ColumnType.NUMERIC, prompt = "用户编号") - private Long userId; - - /** - * 部门ID - */ - @Excel(name = "部门编号", type = Excel.Type.IMPORT) - private String deptId; - - /** - * 部门父ID - */ - private String parentId; - - /** - * 角色ID - */ - private Long roleId; - - /** - * 登录名称 - */ - @Excel(name = "登录名称") - private String loginName; - - /** - * 用户名称 - */ - @Excel(name = "用户名称") - private String userName; - - /** - * 用户邮箱 - */ - @Excel(name = "用户邮箱") - private String email; - - /** - * 手机号码 - */ - @Excel(name = "手机号码") - private String phonenumber; - - /** - * 用户性别 - */ - @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") - private String sex; - - /** - * 用户头像 - */ - private String avatar; - - /** - * 密码 - */ - private String password; - - /** - * 盐加密 - */ - private String salt; - - /** - * 帐号状态(0正常 1停用) - */ - @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") - private String status; - - /** - * 删除标志(0代表存在 2代表删除) - */ - private String delFlag; - - /** - * 最后登陆IP - */ - @Excel(name = "最后登陆IP", type = Excel.Type.EXPORT) - private String loginIp; - - /** - * 最后登陆时间 - */ - @Excel(name = "最后登陆时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT) - private Date loginDate; - - /** - * 部门对象 - */ - @Excels({ - @Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT), - @Excel(name = "部门负责人", targetAttr = "leader", type = Excel.Type.EXPORT) - }) - private Dept dept; - - private List roles; - - /** - * 角色组 - */ - private Long[] roleIds; - - /** - * 岗位组 - */ - private Long[] postIds; - - /** - * 金蝶原始组织结构id(既应急系统部门id) - */ - private String kingdeeOrgId; - - /** - * 金蝶原始用户id - */ - private String kingdeeUserId; - - /** - * 用户类型 0 政务系统用户 1 深i企用户 - */ - private Integer userSource; - - /** - * 职务列表 - */ - List postList; - - /** 用户类型 */ - private String type; - - private SysTenant tenant; - - /** 执法证件号 */ - private String lawCertificateNum; - - /** 部门id */ - private String organizationId; - /** 用户ID */ - private String strUserId; - /** 姓名 */ - private String fullname; - /** 任务ID */ - private String taskId; - /** 业务系统ID */ - private String systemId; - /** 作用点 (CREATE:新建;UPDATE:更新;DELETED:删除;ENABLED:启用;DISABLED:禁用) */ - private String effectOn; - /** 是否删除 (0否;1是)*/ - private String isDeleted; - /** 是否禁用 (0否;1是)*/ - private String isDisabled; - /** 创建日期 */ - private String createAt; - /** 更新日期 */ - private String updateAt; - /** 下游唯一标识 */ - private String guid; - /** 手机号 */ - private String mobileNumber; - /** 证件类型 */ - private String certificateTypeId; - /** 证件类型代码 */ - private String certificateTypeIdCode; - /** 证件号码 */ - private String certificateNumber; - /** 省认证用户id */ - private String srzUserid; - /** 是否驻区人员 */ - private String isMappingPerson; - /** 人员所在部门(包括主岗和兼岗部门) */ - private String units; - /**权限ID*/ - private String dataScopeId; - - /** - * 用户登录密码 - 加密 - */ - private String secretKey; - /** - * 用户登录名称 - 加密 - */ - private String secretName; - - public String getStrUserId() { - return strUserId; - } - - public void setStrUserId(String strUserId) { - this.strUserId = strUserId; - } - - public String getCertificateTypeId() { - return certificateTypeId; - } - - public void setCertificateTypeId(String certificateTypeId) { - this.certificateTypeId = certificateTypeId; - } - - public String getCertificateTypeIdCode() { - return certificateTypeIdCode; - } - - public void setCertificateTypeIdCode(String certificateTypeIdCode) { - this.certificateTypeIdCode = certificateTypeIdCode; - } - - public String getLawCertificateNum() { - return lawCertificateNum; - } - - public void setLawCertificateNum(String lawCertificateNum) { - this.lawCertificateNum = lawCertificateNum; - } - - public SysTenant getTenant() { - return tenant; - } - - public void setTenant(SysTenant tenant) { - this.tenant = tenant; - } - - /** - * 多租户 - */ - private String tenantCode; - - public List getPostList() { - return postList; - } - - public String getTenantCode() { - return tenantCode; - } - - public void setTenantCode(String tenantCode) { - this.tenantCode = tenantCode; - } - - public void setPostList(List postList) { - this.postList = postList; - } - - public String getOrganizationId() { - return organizationId; - } - - public void setOrganizationId(String organizationId) { - this.organizationId = organizationId; - } - - public User() { - - } - - public User(Long userId) { - this.userId = userId; - } - - public Long getUserId() { - return userId; - } - - public void setUserId(Long userId) { - this.userId = userId; - } - - public boolean isAdmin() { - return isAdmin(this.userId); - } - - public static boolean isAdmin(Long userId) { - return userId != null && 1L == userId; - } - - public String getDeptId() { - return deptId; - } - - public void setDeptId(String deptId) { - this.deptId = deptId; - } - - public String getParentId() { - return parentId; - } - - public void setParentId(String parentId) { - this.parentId = parentId; - } - - public Long getRoleId() { - return roleId; - } - - public void setRoleId(Long roleId) { - this.roleId = roleId; - } - - @NotBlank(message = "登录账号不能为空") - @Size(min = 0, max = 30, message = "登录账号长度不能超过30个字符") - public String getLoginName() { - return loginName; - } - - public void setLoginName(String loginName) { - this.loginName = loginName; - } - - @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - @Email(message = "邮箱格式不正确") - @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") - public String getPhonenumber() { - return phonenumber; - } - - private String userType; - - public String getUserType() { - return userType; - } - - public void setUserType(String userType) { - this.userType = userType; - } - - public void setPhonenumber(String phonenumber) { - this.phonenumber = phonenumber; - } - - public String getSex() { - return sex; - } - - public void setSex(String sex) { - this.sex = sex; - } - - public String getAvatar() { - return avatar; - } - - public void setAvatar(String avatar) { - this.avatar = avatar; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getSalt() { - return salt; - } - - public void setSalt(String salt) { - this.salt = salt; - } - - /** - * 生成随机盐 - */ - public void randomSalt() { - // 一个Byte占两个字节,此处生成的3字节,字符串长度为6 - SecureRandomNumberGenerator secureRandom = new SecureRandomNumberGenerator(); - String hex = secureRandom.nextBytes(3).toHex(); - setSalt(hex); - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - public String getDelFlag() { - return delFlag; - } - - public void setDelFlag(String delFlag) { - this.delFlag = delFlag; - } - - public String getLoginIp() { - return loginIp; - } - - public void setLoginIp(String loginIp) { - this.loginIp = loginIp; - } - - public Date getLoginDate() { - return loginDate; - } - - public void setLoginDate(Date loginDate) { - this.loginDate = loginDate; - } - - public Dept getDept() { - if (dept == null) { - dept = new Dept(); - } - return dept; - } - - public void setDept(Dept dept) { - this.dept = dept; - } - - public List getRoles() { - return roles; - } - - public void setRoles(List roles) { - this.roles = roles; - } - - public Long[] getRoleIds() { - return roleIds; - } - - public void setRoleIds(Long[] roleIds) { - this.roleIds = roleIds; - } - - public Long[] getPostIds() { - return postIds; - } - - public void setPostIds(Long[] postIds) { - this.postIds = postIds; - } - - public String getKingdeeOrgId() { - return kingdeeOrgId; - } - - public void setKingdeeOrgId(String kingdeeOrgId) { - this.kingdeeOrgId = kingdeeOrgId; - } - - public String getKingdeeUserId() { - return kingdeeUserId; - } - - public void setKingdeeUserId(String kingdeeUserId) { - this.kingdeeUserId = kingdeeUserId; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getToken() { - return token; - } - - public void setToken(String token) { - this.token = token; - } - - public String getFullname() { - return fullname; - } - - public void setFullname(String fullname) { - this.fullname = fullname; - } - - public String getTaskId() { - return taskId; - } - - public void setTaskId(String taskId) { - this.taskId = taskId; - } - - public String getSystemId() { - return systemId; - } - - public void setSystemId(String systemId) { - this.systemId = systemId; - } - - public String getEffectOn() { - return effectOn; - } - - public void setEffectOn(String effectOn) { - this.effectOn = effectOn; - } - - public String getIsDeleted() { - return isDeleted; - } - - public void setIsDeleted(String isDeleted) { - this.isDeleted = isDeleted; - } - - public String getIsDisabled() { - return isDisabled; - } - - public void setIsDisabled(String isDisabled) { - this.isDisabled = isDisabled; - } - - public String getCreateAt() { - return createAt; - } - - public void setCreateAt(String createAt) { - this.createAt = createAt; - } - - public String getUpdateAt() { - return updateAt; - } - - public void setUpdateAt(String updateAt) { - this.updateAt = updateAt; - } - - public String getGuid() { - return guid; - } - - public void setGuid(String guid) { - this.guid = guid; - } - - public String getMobileNumber() { - return mobileNumber; - } - - public void setMobileNumber(String mobileNumber) { - this.mobileNumber = mobileNumber; - } - - public String getCertificateNumber() { - return certificateNumber; - } - - public void setCertificateNumber(String certificateNumber) { - this.certificateNumber = certificateNumber; - } - - public String getSrzUserid() { - return srzUserid; - } - - public void setSrzUserid(String srzUserid) { - this.srzUserid = srzUserid; - } - - public String getIsMappingPerson() { - return isMappingPerson; - } - - public void setIsMappingPerson(String isMappingPerson) { - this.isMappingPerson = isMappingPerson; - } - - public String getUnits() { - return units; - } - - public void setUnits(String units) { - this.units = units; - } - - public String getDataScopeId() { - return dataScopeId; - } - - public void setDataScopeId(String dataScopeId) { - this.dataScopeId = dataScopeId; - } - - public Integer getUserSource() { - return userSource; - } - - public void setUserSource(Integer userSource) { - this.userSource = userSource; - } - - public String getSecretKey() { - return secretKey; - } - - public void setSecretKey(String secretKey) { - this.secretKey = secretKey; - } - - public String getSecretName() { - return secretName; - } - - public void setSecretName(String secretName) { - this.secretName = secretName; - } - - @Override - public String toString() { - return "User{" + - "userId=" + userId + - ", deptId=" + deptId + - ", parentId=" + parentId + - ", roleId=" + roleId + - ", loginName='" + loginName + '\'' + - ", userName='" + userName + '\'' + - ", email='" + email + '\'' + - ", phonenumber='" + phonenumber + '\'' + - ", sex='" + sex + '\'' + - ", avatar='" + avatar + '\'' + - ", password='" + password + '\'' + - ", salt='" + salt + '\'' + - ", status='" + status + '\'' + - ", delFlag='" + delFlag + '\'' + - ", loginIp='" + loginIp + '\'' + - ", loginDate=" + loginDate + - ", dept=" + dept + - ", roles=" + roles + - ", roleIds=" + Arrays.toString(roleIds) + - ", postIds=" + Arrays.toString(postIds) + - ", kingdeeOrgId='" + kingdeeOrgId + '\'' + - ", kingdeeUserId='" + kingdeeUserId + '\'' + - "} " + super.toString(); - } -} - +package com.zdxt.domain.auth; + + + +import com.zdxt.common.BaseDomain; +import com.zdxt.common.annotation.Excel; +import com.zdxt.common.annotation.Excels; +import org.apache.shiro.crypto.SecureRandomNumberGenerator; + +import javax.validation.constraints.Email; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Size; +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +/** + * 用户对象 sys_user + * + * @author ruoyi + */ +public class User extends BaseDomain { + private static final long serialVersionUID = 1L; + + /** token */ + private String token; + + /** + * 用户ID + */ + @Excel(name = "用户序号", cellType = Excel.ColumnType.NUMERIC, prompt = "用户编号") + private Long userId; + + /** + * 部门ID + */ + @Excel(name = "部门编号", type = Excel.Type.IMPORT) + private String deptId; + + /** + * 部门父ID + */ + private String parentId; + + /** + * 角色ID + */ + private Long roleId; + + /** + * 登录名称 + */ + @Excel(name = "登录名称") + private String loginName; + + /** + * 用户名称 + */ + @Excel(name = "用户名称") + private String userName; + + /** + * 用户邮箱 + */ + @Excel(name = "用户邮箱") + private String email; + + /** + * 手机号码 + */ + @Excel(name = "手机号码") + private String phonenumber; + + /** + * 用户性别 + */ + @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知") + private String sex; + + /** + * 用户头像 + */ + private String avatar; + + /** + * 密码 + */ + private String password; + + /** + * 盐加密 + */ + private String salt; + + /** + * 帐号状态(0正常 1停用) + */ + @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用") + private String status; + + /** + * 删除标志(0代表存在 2代表删除) + */ + private String delFlag; + + /** + * 最后登陆IP + */ + @Excel(name = "最后登陆IP", type = Excel.Type.EXPORT) + private String loginIp; + + /** + * 最后登陆时间 + */ + @Excel(name = "最后登陆时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT) + private Date loginDate; + + /** + * 部门对象 + */ + @Excels({ + @Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT), + @Excel(name = "部门负责人", targetAttr = "leader", type = Excel.Type.EXPORT) + }) + private Dept dept; + + private List roles; + + /** + * 角色组 + */ + private Long[] roleIds; + + /** + * 岗位组 + */ + private Long[] postIds; + + /** + * 金蝶原始组织结构id(既应急系统部门id) + */ + private String kingdeeOrgId; + + /** + * 金蝶原始用户id + */ + private String kingdeeUserId; + + /** + * 用户类型 0 政务系统用户 1 深i企用户 + */ + private Integer userSource; + + /** + * 职务列表 + */ + List postList; + + /** 用户类型 */ + private String type; + + private SysTenant tenant; + + /** 执法证件号 */ + private String lawCertificateNum; + + /** 部门id */ + private String organizationId; + /** 用户ID */ + private String strUserId; + /** 姓名 */ + private String fullname; + /** 任务ID */ + private String taskId; + /** 业务系统ID */ + private String systemId; + /** 作用点 (CREATE:新建;UPDATE:更新;DELETED:删除;ENABLED:启用;DISABLED:禁用) */ + private String effectOn; + /** 是否删除 (0否;1是)*/ + private String isDeleted; + /** 是否禁用 (0否;1是)*/ + private String isDisabled; + /** 创建日期 */ + private String createAt; + /** 更新日期 */ + private String updateAt; + /** 下游唯一标识 */ + private String guid; + /** 手机号 */ + private String mobileNumber; + /** 证件类型 */ + private String certificateTypeId; + /** 证件类型代码 */ + private String certificateTypeIdCode; + /** 证件号码 */ + private String certificateNumber; + /** 省认证用户id */ + private String srzUserid; + /** 是否驻区人员 */ + private String isMappingPerson; + /** 人员所在部门(包括主岗和兼岗部门) */ + private String units; + /**权限ID*/ + private String dataScopeId; + + /** + * 用户登录密码 - 加密 + */ + private String secretKey; + /** + * 用户登录名称 - 加密 + */ + private String secretName; + + private String notUserId; + + public String getNotUserId() { + return notUserId; + } + + public void setNotUserId(String notUserId) { + this.notUserId = notUserId; + } + + public String getStrUserId() { + return strUserId; + } + + public void setStrUserId(String strUserId) { + this.strUserId = strUserId; + } + + public String getCertificateTypeId() { + return certificateTypeId; + } + + public void setCertificateTypeId(String certificateTypeId) { + this.certificateTypeId = certificateTypeId; + } + + public String getCertificateTypeIdCode() { + return certificateTypeIdCode; + } + + public void setCertificateTypeIdCode(String certificateTypeIdCode) { + this.certificateTypeIdCode = certificateTypeIdCode; + } + + public String getLawCertificateNum() { + return lawCertificateNum; + } + + public void setLawCertificateNum(String lawCertificateNum) { + this.lawCertificateNum = lawCertificateNum; + } + + public SysTenant getTenant() { + return tenant; + } + + public void setTenant(SysTenant tenant) { + this.tenant = tenant; + } + + /** + * 多租户 + */ + private String tenantCode; + + public List getPostList() { + return postList; + } + + public String getTenantCode() { + return tenantCode; + } + + public void setTenantCode(String tenantCode) { + this.tenantCode = tenantCode; + } + + public void setPostList(List postList) { + this.postList = postList; + } + + public String getOrganizationId() { + return organizationId; + } + + public void setOrganizationId(String organizationId) { + this.organizationId = organizationId; + } + + public User() { + + } + + public User(Long userId) { + this.userId = userId; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public boolean isAdmin() { + return isAdmin(this.userId); + } + + public static boolean isAdmin(Long userId) { + return userId != null && 1L == userId; + } + + public String getDeptId() { + return deptId; + } + + public void setDeptId(String deptId) { + this.deptId = deptId; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + @NotBlank(message = "登录账号不能为空") + @Size(min = 0, max = 30, message = "登录账号长度不能超过30个字符") + public String getLoginName() { + return loginName; + } + + public void setLoginName(String loginName) { + this.loginName = loginName; + } + + @Size(min = 0, max = 30, message = "用户昵称长度不能超过30个字符") + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + @Email(message = "邮箱格式不正确") + @Size(min = 0, max = 50, message = "邮箱长度不能超过50个字符") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符") + public String getPhonenumber() { + return phonenumber; + } + + private String userType; + + public String getUserType() { + return userType; + } + + public void setUserType(String userType) { + this.userType = userType; + } + + public void setPhonenumber(String phonenumber) { + this.phonenumber = phonenumber; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getSalt() { + return salt; + } + + public void setSalt(String salt) { + this.salt = salt; + } + + /** + * 生成随机盐 + */ + public void randomSalt() { + // 一个Byte占两个字节,此处生成的3字节,字符串长度为6 + SecureRandomNumberGenerator secureRandom = new SecureRandomNumberGenerator(); + String hex = secureRandom.nextBytes(3).toHex(); + setSalt(hex); + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getDelFlag() { + return delFlag; + } + + public void setDelFlag(String delFlag) { + this.delFlag = delFlag; + } + + public String getLoginIp() { + return loginIp; + } + + public void setLoginIp(String loginIp) { + this.loginIp = loginIp; + } + + public Date getLoginDate() { + return loginDate; + } + + public void setLoginDate(Date loginDate) { + this.loginDate = loginDate; + } + + public Dept getDept() { + if (dept == null) { + dept = new Dept(); + } + return dept; + } + + public void setDept(Dept dept) { + this.dept = dept; + } + + public List getRoles() { + return roles; + } + + public void setRoles(List roles) { + this.roles = roles; + } + + public Long[] getRoleIds() { + return roleIds; + } + + public void setRoleIds(Long[] roleIds) { + this.roleIds = roleIds; + } + + public Long[] getPostIds() { + return postIds; + } + + public void setPostIds(Long[] postIds) { + this.postIds = postIds; + } + + public String getKingdeeOrgId() { + return kingdeeOrgId; + } + + public void setKingdeeOrgId(String kingdeeOrgId) { + this.kingdeeOrgId = kingdeeOrgId; + } + + public String getKingdeeUserId() { + return kingdeeUserId; + } + + public void setKingdeeUserId(String kingdeeUserId) { + this.kingdeeUserId = kingdeeUserId; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getFullname() { + return fullname; + } + + public void setFullname(String fullname) { + this.fullname = fullname; + } + + public String getTaskId() { + return taskId; + } + + public void setTaskId(String taskId) { + this.taskId = taskId; + } + + public String getSystemId() { + return systemId; + } + + public void setSystemId(String systemId) { + this.systemId = systemId; + } + + public String getEffectOn() { + return effectOn; + } + + public void setEffectOn(String effectOn) { + this.effectOn = effectOn; + } + + public String getIsDeleted() { + return isDeleted; + } + + public void setIsDeleted(String isDeleted) { + this.isDeleted = isDeleted; + } + + public String getIsDisabled() { + return isDisabled; + } + + public void setIsDisabled(String isDisabled) { + this.isDisabled = isDisabled; + } + + public String getCreateAt() { + return createAt; + } + + public void setCreateAt(String createAt) { + this.createAt = createAt; + } + + public String getUpdateAt() { + return updateAt; + } + + public void setUpdateAt(String updateAt) { + this.updateAt = updateAt; + } + + public String getGuid() { + return guid; + } + + public void setGuid(String guid) { + this.guid = guid; + } + + public String getMobileNumber() { + return mobileNumber; + } + + public void setMobileNumber(String mobileNumber) { + this.mobileNumber = mobileNumber; + } + + public String getCertificateNumber() { + return certificateNumber; + } + + public void setCertificateNumber(String certificateNumber) { + this.certificateNumber = certificateNumber; + } + + public String getSrzUserid() { + return srzUserid; + } + + public void setSrzUserid(String srzUserid) { + this.srzUserid = srzUserid; + } + + public String getIsMappingPerson() { + return isMappingPerson; + } + + public void setIsMappingPerson(String isMappingPerson) { + this.isMappingPerson = isMappingPerson; + } + + public String getUnits() { + return units; + } + + public void setUnits(String units) { + this.units = units; + } + + public String getDataScopeId() { + return dataScopeId; + } + + public void setDataScopeId(String dataScopeId) { + this.dataScopeId = dataScopeId; + } + + public Integer getUserSource() { + return userSource; + } + + public void setUserSource(Integer userSource) { + this.userSource = userSource; + } + + public String getSecretKey() { + return secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public String getSecretName() { + return secretName; + } + + public void setSecretName(String secretName) { + this.secretName = secretName; + } + + @Override + public String toString() { + return "User{" + + "userId=" + userId + + ", deptId=" + deptId + + ", parentId=" + parentId + + ", roleId=" + roleId + + ", loginName='" + loginName + '\'' + + ", userName='" + userName + '\'' + + ", email='" + email + '\'' + + ", phonenumber='" + phonenumber + '\'' + + ", sex='" + sex + '\'' + + ", avatar='" + avatar + '\'' + + ", password='" + password + '\'' + + ", salt='" + salt + '\'' + + ", status='" + status + '\'' + + ", delFlag='" + delFlag + '\'' + + ", loginIp='" + loginIp + '\'' + + ", loginDate=" + loginDate + + ", dept=" + dept + + ", roles=" + roles + + ", roleIds=" + Arrays.toString(roleIds) + + ", postIds=" + Arrays.toString(postIds) + + ", kingdeeOrgId='" + kingdeeOrgId + '\'' + + ", kingdeeUserId='" + kingdeeUserId + '\'' + + "} " + super.toString(); + } +} + diff --git a/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppNonEnforcementRegistrationController.java b/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppNonEnforcementRegistrationController.java new file mode 100644 index 00000000..42e4bde3 --- /dev/null +++ b/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppNonEnforcementRegistrationController.java @@ -0,0 +1,85 @@ +package com.zdxt.app.controller; + +import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.StrUtil; +import com.zdxt.auth.dto.DeptBean; +import com.zdxt.auth.dto.DictDataBean; +import com.zdxt.auth.dto.UserBean; +import com.zdxt.auth.feign.DictDataApi; +import com.zdxt.auth.feign.UserApi; +import com.zdxt.auth.project.system.user.service.IUserService; +import com.zdxt.code.domain.*; +import com.zdxt.code.service.*; +import com.zdxt.common.ZDResponse; +import com.zdxt.common.controller.BaseController; +import com.zdxt.common.util.StringUtils; +import com.zdxt.common.util.TableDataInfo; +import com.zdxt.common.zdxtFile.ZdxtFileCommon; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; + +import java.time.Instant; +import java.time.LocalDate; +import java.time.ZoneId; +import java.time.temporal.ChronoUnit; +import java.util.*; + + +/** + * 执法端-执法登记Controller + * + * @author chenrui + * @date 2024-02-23 + */ +@Controller +@RequestMapping("/app/code/nonRegistration") +public class AppNonEnforcementRegistrationController extends BaseController +{ + private String prefix = "project/code/registration"; + + @Autowired private INonEnforcementRegistrationService enforcementRegistrationService; + + @RequiresPermissions("code:registration:view") + @GetMapping() + public String registration() + { + return prefix + "/registration"; + } + + /** + * 新增保存执法端-执法登记 + */ + @PostMapping("/add") + @ResponseBody + public ZDResponse addSave(@RequestBody NonEnforcementRegistration enforcementRegistration) + { + return enforcementRegistrationService.insertNonEnforcementRegistration(enforcementRegistration) > 0 + ? ZDResponse.success("保存成功") : ZDResponse.error("保存失败"); + } + + /** + * 查询执法端-执法登记列表 + */ + @GetMapping("/queryList") + @ResponseBody + public ZDResponse queryListNew(NonEnforcementRegistration enforcementRegistration) + { + //查询检查总次数 + List registrations = enforcementRegistrationService.selectNonEnforcementRegistrationList(enforcementRegistration); + return ZDResponse.success("操作成功", registrations); + } + + /** + * 查询执法端-执法登记列表 + */ + @GetMapping("/queryById/{id}") + @ResponseBody + public ZDResponse queryById(@PathVariable String id) + { + NonEnforcementRegistration registrations = enforcementRegistrationService.selectNonEnforcementRegistrationById(id); + return ZDResponse.success("操作成功", registrations); + } +} diff --git a/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppSystemController.java b/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppSystemController.java index 44574ea9..31d73db1 100644 --- a/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppSystemController.java +++ b/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppSystemController.java @@ -61,19 +61,32 @@ public class AppSystemController extends BaseController { @GetMapping("/getUserInfo/{userId}") @ResponseBody public ZDResponse getUserInfo(@PathVariable Long userId){ -// UserBean user = userApi.getCurrentUser(); UserBean user = userApi.getUserByUserId(userId); + /** 通过执法证件号->双系统(统一信用代码)->部门(统一信用代码) start 改成直接通过打标迭代的方式来获取用户部门信息 */ +// //查询双系统执法人员信息 +// Zfryjdm2405301 zfryjdm2405301 = iZfryjdm2405301Service.selectZfryByZfCode(user.getLawCertificateNum()); +// //通过机构代码查询执法主体信息 +// DeptBean bureauDept = deptApi.selectDeptByCreditcode(zfryjdm2405301.getZzjgdm()); + /** 通过执法证件号->双系统(统一信用代码)->部门(统一信用代码) end 改成直接通过打标迭代的方式来获取用户部门信息 */ + //查询本人所在部门 + DeptBean dept = deptApi.getDeptById(user.getDeptId()); + /** 迭代的的方式查执法主体 */ + DeptBean bureauDept = deptApi.iterationDeptParentToBureau(user.getDeptId()); + user.setDept(dept); + user.setBureauDept(bureauDept); - //查询双系统执法人员信息 - Zfryjdm2405301 zfryjdm2405301 = - iZfryjdm2405301Service.selectZfryByZfCode(user.getLawCertificateNum()); - //通过机构代码查询执法主体信息 - DeptBean dept1 = deptApi.selectDeptByCreditcode(zfryjdm2405301.getZzjgdm()); + return ZDResponse.success("查询成功",user); + } - //查询本人所在部门 + @GetMapping("/getUserInfoAndDept/{userId}") + @ResponseBody + public ZDResponse getUserInfoAndDept(@PathVariable Long userId){ + UserBean user = userApi.getUserByUserId(userId); DeptBean dept = deptApi.getDeptById(user.getDeptId()); + DeptBean bureauDept = deptApi.iterationDeptParentToBureau(user.getDeptId()); + // 通过迭代获取用户的执法主体 user.setDept(dept); - user.setBureauDept(dept1); + user.setBureauDept(bureauDept); return ZDResponse.success("查询成功",user); } diff --git a/lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/feign/DeptApiImpl.java b/lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/feign/DeptApiImpl.java index 25f36ac9..18a1453d 100644 --- a/lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/feign/DeptApiImpl.java +++ b/lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/feign/DeptApiImpl.java @@ -279,6 +279,30 @@ public class DeptApiImpl implements DeptApi { return iterationDeptParent(dept.getParentId()); } + // 递归获取部门 + public DeptBean iterationDeptParentToBureau(String deptId) { + DeptApi deptApi = SpringUtil.getBean(DeptApi.class); + DeptBean dept = deptApi.getDeptById(deptId); + Optional op =Optional.ofNullable(dept); + if(!op.isPresent() || deptId == null)return null; // 防止admin这种没有部门的进来后造成死循环 + if (null != dept.getZone() && 0 != dept.getZone() && 2 != dept.getZone()) { + return dept; + } + return iterationDeptParentToBureau(dept.getParentId()); + } + + // 递归获取部门获取公安 + public DeptBean iterationDeptParentToBureauGA(String deptId) { + DeptApi deptApi = SpringUtil.getBean(DeptApi.class); + DeptBean dept = deptApi.getDeptById(deptId); + Optional op =Optional.ofNullable(dept); + if(!op.isPresent() || deptId == null)return null; // 防止admin这种没有部门的进来后造成死循环 + if (null != dept.getZone() && (5 == dept.getZone() || 1 == dept.getZone())) { + return dept; + } + return iterationDeptParentToBureauGA(dept.getParentId()); + } + @Override public DeptBean iterationDeptParentRegion(String deptId) { DeptApi deptApi = SpringUtil.getBean(DeptApi.class); diff --git a/lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/dept/service/DeptServiceImpl.java b/lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/dept/service/DeptServiceImpl.java index 68d5c1f4..28142a52 100644 --- a/lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/dept/service/DeptServiceImpl.java +++ b/lib/EmergencyService/zdxtEmergencyAuthService/src/main/java/com/zdxt/auth/project/system/dept/service/DeptServiceImpl.java @@ -1,665 +1,665 @@ -package com.zdxt.auth.project.system.dept.service; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.zdxt.auth.common.constant.UserConstants; -import com.zdxt.auth.common.exception.BusinessException; -import com.zdxt.auth.common.utils.StringUtils; -import com.zdxt.auth.common.utils.security.ShiroUtils; -import com.zdxt.auth.project.system.dept.mapper.DeptMapper; -import com.zdxt.auth.project.system.dict.service.IDictDataService; -import com.zdxt.common.annotation.DataScope; -import com.zdxt.common.domain.Ztree; -import com.zdxt.domain.auth.Dept; -import com.zdxt.domain.auth.DictData; -import com.zdxt.domain.auth.Role; -import com.zdxt.domain.auth.SysTenant; - -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.collections.map.HashedMap; -import org.apache.http.HttpEntity; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.StringEntity; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.util.EntityUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.security.MessageDigest; -import java.util.*; -import java.util.stream.Collectors; - -/** - * 部门管理 服务实现 - * - * @author ruoyi - */ -@Service -public class DeptServiceImpl implements IDeptService -{ - private static final Logger log = LoggerFactory.getLogger(DeptServiceImpl.class); - - @Autowired - private DeptMapper deptMapper; - - @Autowired - private IDictDataService dictDataService; - - @Value("${srnwg.url}") - private String znwgUrl; - @Value("${srnwg.paasId}") - private String paasId; - @Value("${srnwg.paasToken}") - private String paasToken; - - /** - * 修改保存部门信息 - * @param dept 部门信息 - * @return 结果 - */ - @Override - @Transactional - public int updateDeptIsKingDee(Dept dept) - { - Dept newParentDept = deptMapper.selectDeptById(dept.getParentId()); - Dept oldDept = selectDeptById(dept.getDeptId()); - if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) - { - String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); - String oldAncestors = oldDept.getAncestors(); - dept.setAncestors(newAncestors); -// updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); - } - int result = deptMapper.updateDept(dept); -// if (UserConstants.DEPT_NORMAL.equals(dept.getStatus())) -// { -// // 如果该部门是启用状态,则启用该部门的所有上级部门 -// updateParentDeptStatus(dept); -// } - return result; - } - - - /** - * 根据金蝶原始部门id,查询部门 - * @param kingdeeOrgId - * @return - */ - @Override - public Dept selectDeptByKingdeeOrgId(String kingdeeOrgId) { - return deptMapper.selectDeptByKingdeeOrgId(kingdeeOrgId); - } - - /** - * 查询部门管理数据 - * - * @param dept 部门信息 - * @return 部门信息集合 - */ - @DataScope(deptAlias = "d") - @Override - public List selectDeptList(Dept dept) - { - return deptMapper.selectDeptList(dept); - } - - /** - * 查询部门管理数据 - * - * @param dept 部门信息 - * @return 部门信息集合 - */ - @Override - public List selectDeptNotRoleList(Dept dept) { - return deptMapper.selectDeptList(dept); - } - - /** - * 查询部门管理树 - * - * @param dept 部门信息 - * @return 所有部门信息 - */ - @Override - @DataScope(deptAlias = "d") - public List selectDeptTree(Dept dept) - { - List deptList = deptMapper.selectDeptList(dept); - List ztrees = initZtree(deptList); - return ztrees; - } - - @Override - @DataScope(deptAlias = "d") - public List selectDeptTreeNew(Dept dept) - { - List deptList = deptMapper.selectDeptList(dept); - List ztrees = initZtree(deptList); - ztrees = getZtrees(ztrees); - return ztrees; - } - - private List getZtrees(List ztrees) { - if (CollectionUtils.isNotEmpty(ztrees)) { - //拿到深圳市 - Ztree ztree = new Ztree(); - ztree.setpId("0"); - ztree.setId("0"); - ztree.setTitle("深圳市"); - ztree.setName("深圳市"); - ztrees.add(ztree); - //拿到角色区分 - List list = dictDataService.selectDictDataByType("role_tree_zone"); - if (CollectionUtils.isNotEmpty(list)) { - // 进行拆解封装 - List zoneTree = list.stream() - .filter(item -> Objects.equals(item.getDictValue(), "1") || - Objects.equals(item.getDictValue(), "2")) - .map(item -> { - Ztree ztree1 = new Ztree(); - ztree1.setTitle(item.getDictLabel()); - ztree1.setName(item.getDictLabel()); - ztree1.setId(item.getDictValue()); - ztree1.setpId("0"); - return ztree1; - }).collect(Collectors.toList()); - ztrees.addAll(zoneTree); - - //给市值和区挂上深圳市 - ztrees = ztrees.stream() - .peek(i -> i.setpId(Objects.equals(i.getZone(), 1) || - Objects.equals(i.getZone(), 2) ? String.valueOf(i.getZone()) : i.getpId())) - .collect(Collectors.toList()); - - - List collect = ztrees.stream() - .filter(item -> Objects.equals(item.getZone(), 2)) - .map(Ztree::getId).collect(Collectors.toList()); - for (String pid : collect) { - //给区直挂上区直 - Ztree ztree1 = new Ztree(); - ztree1.setTitle("区直"); - ztree1.setName("区直"); - ztree1.setId(pid+"3"); - ztree1.setpId(pid); - ztrees.add(ztree1); - // - for (Ztree ztree2 : ztrees) { - if (Objects.equals(ztree2.getZone(), 3) && - StringUtils.isNotEmpty(ztree2.getAncestors()) && ztree2.getAncestors().contains(pid)) { - ztree2.setpId(ztree1.getId()); - } - } - } - } - } - return ztrees; - } - - @Override - public List selectDeptTreeNotRole(Dept dept) - { - List deptList = deptMapper.selectDeptList(dept); - List ztrees = initZtree(deptList); - return ztrees; - } - - /** - * 根据角色ID查询部门(数据权限) - * - * @param role 角色对象 - * @return 部门列表(数据权限) - */ - @Override - public List roleDeptTreeData(Role role) - { - Long roleId = role.getRoleId(); - List ztrees = new ArrayList(); - Dept dept = new Dept(); - dept.setZoneList(role.getZoneList()); - List deptList = selectDeptList(dept); - if (StringUtils.isNotNull(roleId)) - { - List roleDeptList = deptMapper.selectRoleDeptTree(roleId); - ztrees = initZtree(deptList, roleDeptList); - } - else - { - ztrees = initZtree(deptList); - } - if (CollectionUtils.isNotEmpty(role.getZoneList())) { - ztrees = getZtrees(ztrees); - } - return ztrees; - } - - /** - * 对象转部门树 - * - * @param deptList 部门列表 - * @return 树结构列表 - */ - public List initZtree(List deptList) - { - return initZtree(deptList, null); - } - - /** - * 对象转部门树 - * - * @param deptList 部门列表 - * @param roleDeptList 角色已存在菜单列表 - * @return 树结构列表 - */ - public List initZtree(List deptList, List roleDeptList) - { - List ztrees = new ArrayList(); - boolean isCheck = StringUtils.isNotNull(roleDeptList); - for (Dept dept : deptList) - { - if (UserConstants.DEPT_NORMAL.equals(dept.getStatus())) - { - Ztree ztree = new Ztree(); - ztree.setId(dept.getDeptId()); - ztree.setpId(dept.getParentId()); - ztree.setName(dept.getDeptName()); - ztree.setTitle(dept.getDeptName()); - ztree.setAncestors(dept.getAncestors()); - ztree.setZone(dept.getZone()); - if (isCheck) - { - ztree.setChecked(roleDeptList.contains(dept.getDeptId() + dept.getDeptName())); - } - ztrees.add(ztree); - } - } - return ztrees; - } - - /** - * 查询部门人数 - * - * @param parentId 部门ID - * @return 结果 - */ - @Override - public int selectDeptCount(String parentId) - { - Dept dept = new Dept(); - dept.setParentId(parentId); - return deptMapper.selectDeptCount(dept); - } - - /** - * 查询部门是否存在用户 - * - * @param deptId 部门ID - * @return 结果 true 存在 false 不存在 - */ - @Override - public boolean checkDeptExistUser(String deptId) - { - int result = deptMapper.checkDeptExistUser(deptId); - return result > 0 ? true : false; - } - - /** - * 删除部门管理信息 - * - * @param deptId 部门ID - * @return 结果 - */ - @Override - public int deleteDeptById(String deptId) - { - return deptMapper.deleteDeptById(deptId); - } - - /** - * 新增保存部门信息 - * - * @param dept 部门信息 - * @return 结果 - */ - @Override - public int insertDept(Dept dept) - { - Dept info = deptMapper.selectDeptById(dept.getParentId()); - // 如果父节点不为"正常"状态,则不允许新增子节点 - if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) - { - throw new BusinessException("部门停用,不允许新增"); - } - dept.setCreateBy(ShiroUtils.getLoginName()); - dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); - return deptMapper.insertDept(dept); - } - - /** - * 修改保存部门信息 - * @param dept 部门信息 - * @return 结果 - */ - @Override - @Transactional - public int updateDept(Dept dept) - { - Dept newParentDept = deptMapper.selectDeptById(dept.getParentId()); - Dept oldDept = selectDeptById(dept.getDeptId()); - if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) - { - String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); - String oldAncestors = oldDept.getAncestors(); - dept.setAncestors(newAncestors); - updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); - } - dept.setUpdateBy(ShiroUtils.getLoginName()); - int result = deptMapper.updateDept(dept); - - // 判断是否有对应的企业信息, 如果有的话. 需要同时更新企业那边的信息 - - - if (UserConstants.DEPT_NORMAL.equals(dept.getStatus())) - { - // 如果该部门是启用状态,则启用该部门的所有上级部门 - updateParentDeptStatus(dept); - } - return result; - } - - @Override - public int updateDeptName(Dept dept) { - return deptMapper.updateDept(dept); - } - - /** - * 修改该部门的父级部门状态 - * - * @param dept 当前部门 - */ - private void updateParentDeptStatus(Dept dept) - { - String updateBy = dept.getUpdateBy(); - dept = deptMapper.selectDeptById(dept.getDeptId()); - dept.setUpdateBy(updateBy); - deptMapper.updateDeptStatus(dept); - } - - /** - * 修改子元素关系 - * - * @param deptId 被修改的部门ID - * @param newAncestors 新的父ID集合 - * @param oldAncestors 旧的父ID集合 - */ - public void updateDeptChildren(String deptId, String newAncestors, String oldAncestors) - { - List children = deptMapper.selectChildrenDeptById(deptId); - for (Dept child : children) - { - child.setAncestors(child.getAncestors().replace(oldAncestors, newAncestors)); - } - if (children.size() > 0) - { - deptMapper.updateDeptChildren(children); - } - } - - /** - * 修改子元素关系 - * - * @param deptId 部门ID - * @param ancestors 元素列表 - */ - public void updateDeptChildren(String deptId, String ancestors) - { - Dept dept = new Dept(); - dept.setParentId(deptId); - List childrens = deptMapper.selectDeptList(dept); - for (Dept children : childrens) - { - children.setAncestors(ancestors + "," + dept.getParentId()); - } - if (childrens.size() > 0) - { - deptMapper.updateDeptChildren(childrens); - } - } - - /** - * 根据部门ID查询信息 - * - * @param deptId 部门ID - * @return 部门信息 - */ - @Override - public Dept selectDeptById(String deptId) - { - return deptMapper.selectDeptById(deptId); - } - - /** - * 校验部门名称是否唯一 - * - * @param dept 部门信息 - * @return 结果 - */ - @Override - public String checkDeptNameUnique(Dept dept) - { - String deptId = StringUtils.isNull(dept.getDeptId()) ? "-1" : dept.getDeptId(); - Dept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId()); - if (StringUtils.isNotNull(info) && info.getDeptId().equals(deptId)) - { - return UserConstants.DEPT_NAME_NOT_UNIQUE; - } - return UserConstants.DEPT_NAME_UNIQUE; - } - - /** - * 部门数据 不过滤权限 - * @param dept 部门信息 - * @return - */ - @Override - public List selectDeptTreeByNoPermission(Dept dept) { - List deptList = deptMapper.selectDeptListByNoPermission(dept); - List ztrees = initZtree(deptList); - return ztrees; - } - /** - * 查询部门管理数据 - * - * @param dept 部门信息 - * @return 部门信息集合 - */ - @Override - public List selectDeptListNoPermission(Dept dept){ - return deptMapper.selectDeptList(dept); - } - - @Override - public Dept insertSysDeptDefault(SysTenant tenant) { - Dept dept = new Dept(); - //父级部门 - dept.setParentId("0"); - dept.setDeptName(tenant.getTenantName()); - dept.setAncestors("0"); - dept.setTenantCode(tenant.getTenantCode()); - dept.setOrderNum("0"); - dept.setLeader(tenant.getContactMan()); - dept.setPhone(tenant.getContactNumber()); - dept.setCreateBy(ShiroUtils.getLoginName()); - dept.setRemark("租户分配系统自动创建部门"); - deptMapper.insertDept(dept); - return dept; - } - - /** - * 根据部门信息获取当前及一下所有部门(下钻) - * - * @param dept 部门信息 - * @return 部门信息集合 - */ - @Override - public List selectDeptListHole(Dept dept){ - return deptMapper.selectDeptListHole(dept); - } - - - @Override - public Map addSrzDept(JSONArray dataArr,String token) { - int insertNum = 0; - int updateNum = 0; - for (int i = 0; i < dataArr.size(); i++) { - JSONObject jsonObject = dataArr.getJSONObject(i); - if (StringUtils.isEmpty(jsonObject.getString("organizationId"))) { continue; } - - try { - // 返回每条拉取的成功情况 - String taskId = jsonObject.getString("taskId"); - String params = "{\"token\":\"" + token + "\",\"data\":[{\"taskId\":\"" + taskId + "\",\"result\":\"SUCCESS\"}]}"; - String doneStr = connect("/ebus/sfrzhqxglmk/sysDoneTorg", params); - JSONObject doneObj = JSONObject.parseObject(doneStr); - String done = doneObj.getString("success"); - log.info("部门拉取完成结果 ========> :{}", done); - } catch (Exception e) { - log.info("部门数据下拉完成异常,异常任务id:{}",jsonObject.getString("taskId")); - e.printStackTrace(); - } - Dept dept = new Dept(); - dept.setDeptId(jsonObject.getString("organizationId")); - dept.setParentId(jsonObject.getString("parentId")); - dept.setDeptName(jsonObject.getString("name")); - dept.setOrganizationId(jsonObject.getString("organizationId")); - dept.setOrganizationParentId(jsonObject.getString("parentId")); - dept.setZzLevel(Integer.valueOf(jsonObject.getString("zzLevel"))); - dept.setCode(jsonObject.getString("code")); - dept.setMappingUnitParentId(jsonObject.getString("mappingUnitParentId")); - dept.setUpdateAt(jsonObject.getString("updateAt")); - dept.setCreateAt(jsonObject.getString("createAt")); - dept.setDescription(jsonObject.getString("description")); - dept.setEffectOn(jsonObject.getString("effectOn")); - dept.setSequence(jsonObject.getString("sequence")); - dept.setIsDeleted(jsonObject.getString("isDeleted")); - dept.setZzDisplayPath(jsonObject.getString("zzDisplayPath")); - dept.setName(jsonObject.getString("name")); - dept.setGuid(jsonObject.getString("guid")); - dept.setZzIsLeaf(jsonObject.getString("zzIsLeaf")); - dept.setIsDisabled(jsonObject.getString("isDisabled")); - dept.setFullname(jsonObject.getString("fullname")); - dept.setIsMappingUnit(jsonObject.getString("isMappingUnit")); - dept.setSrzUnitId(jsonObject.getString("srzUnitId")); - dept.setTaskId(jsonObject.getString("taskId")); - dept.setSystemId(jsonObject.getString("systemId")); - dept.setCreditcode(jsonObject.getString("creditcode")); - - Dept uniqueDept = deptMapper.selectDeptByOrganizationId(jsonObject.getString("organizationId")); - if (null != uniqueDept && uniqueDept.getOrganizationId() != null) { - // 跟新数据库 - int rowNum = deptMapper.updateDeptByOrganizationId(dept); - updateNum += rowNum; - } else { - // 插入数据库 - int rowNum = deptMapper.insertDept(dept); - insertNum += rowNum; - } - } - Map resMap = new HashedMap(); - resMap.put("insertNum", insertNum); - resMap.put("updateNum", updateNum); - return resMap; - } - - @Override - public List selectDeptAll() - { - return deptMapper.selectDeptAll(); - } - - @Override - public int updateAncestorsById(Dept dept) { - return deptMapper.updateAncestorsById(dept); - } - - - private String connect(String apiPath, String params) { - //各种参数 - - try { -// String params = "{\"uid\":\"5b07b3de672c4e999c4b04f4\"}"; //请求接⼝的参数 - - long now = new Date().getTime(); - String timestamp = Long.toString((long) Math.floor(now / 1000)); - String nonce = Long.toHexString(now) + "-" + Long.toHexString((long) Math.floor(Math.random() * 0xFFFFFF)); - String signature = toSHA256(timestamp + paasToken + nonce + timestamp); - - - //创建CloseableHttpClient - CloseableHttpClient client = HttpClientBuilder.create().build(); - HttpPost httpPost = new HttpPost(znwgUrl + apiPath); - httpPost.setHeader("x-tif-paasid", paasId); - httpPost.setHeader("x-tif-timestamp", timestamp); - httpPost.setHeader("x-tif-signature", signature); - httpPost.setHeader("x-tif-nonce", nonce); - httpPost.setHeader("Content-Type", "application/json"); - httpPost.setHeader("Cache-Control", "no-cache"); - HttpEntity entity = new StringEntity(params); - - - httpPost.setEntity(entity); - - CloseableHttpResponse response = client.execute(httpPost); - - return EntityUtils.toString(response.getEntity()); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - private String toSHA256(String str) throws Exception { - MessageDigest messageDigest; - String encodeStr = ""; - try { - messageDigest = MessageDigest.getInstance("SHA-256"); - messageDigest.update(str.getBytes("UTF-8")); - encodeStr = byte2Hex(messageDigest.digest()); - } catch (Exception e) { - throw e; - } - return encodeStr; - } - - // byte转换成16进制 - private String byte2Hex(byte[] bytes) { - StringBuffer stringBuffer = new StringBuffer(); - String temp = null; - for (int i = 0; i < bytes.length; i++) { - temp = Integer.toHexString(bytes[i] & 0xFF); - if (temp.length() == 1) { - stringBuffer.append("0"); - } - stringBuffer.append(temp); - } - return stringBuffer.toString(); - } - @Override - public List selectDeptByDeptName(String string){ - return deptMapper.selectDeptByDeptName(string); - } - @Override - public Dept selectDeptByDeptName2(String string){ - return deptMapper.selectDeptByDeptName2(string); - } - @Override - public Dept selectDeptByCreditcode(String string){ - return deptMapper.selectDeptByCreditcode(string); - } -} +package com.zdxt.auth.project.system.dept.service; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.zdxt.auth.common.constant.UserConstants; +import com.zdxt.auth.common.exception.BusinessException; +import com.zdxt.auth.common.utils.StringUtils; +import com.zdxt.auth.common.utils.security.ShiroUtils; +import com.zdxt.auth.project.system.dept.mapper.DeptMapper; +import com.zdxt.auth.project.system.dict.service.IDictDataService; +import com.zdxt.common.annotation.DataScope; +import com.zdxt.common.domain.Ztree; +import com.zdxt.domain.auth.Dept; +import com.zdxt.domain.auth.DictData; +import com.zdxt.domain.auth.Role; +import com.zdxt.domain.auth.SysTenant; + +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections.map.HashedMap; +import org.apache.http.HttpEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.security.MessageDigest; +import java.util.*; +import java.util.stream.Collectors; + +/** + * 部门管理 服务实现 + * + * @author ruoyi + */ +@Service +public class DeptServiceImpl implements IDeptService +{ + private static final Logger log = LoggerFactory.getLogger(DeptServiceImpl.class); + + @Autowired + private DeptMapper deptMapper; + + @Autowired + private IDictDataService dictDataService; + + @Value("${srnwg.url}") + private String znwgUrl; + @Value("${srnwg.paasId}") + private String paasId; + @Value("${srnwg.paasToken}") + private String paasToken; + + /** + * 修改保存部门信息 + * @param dept 部门信息 + * @return 结果 + */ + @Override + @Transactional + public int updateDeptIsKingDee(Dept dept) + { + Dept newParentDept = deptMapper.selectDeptById(dept.getParentId()); + Dept oldDept = selectDeptById(dept.getDeptId()); + if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) + { + String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); + String oldAncestors = oldDept.getAncestors(); + dept.setAncestors(newAncestors); +// updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); + } + int result = deptMapper.updateDept(dept); +// if (UserConstants.DEPT_NORMAL.equals(dept.getStatus())) +// { +// // 如果该部门是启用状态,则启用该部门的所有上级部门 +// updateParentDeptStatus(dept); +// } + return result; + } + + + /** + * 根据金蝶原始部门id,查询部门 + * @param kingdeeOrgId + * @return + */ + @Override + public Dept selectDeptByKingdeeOrgId(String kingdeeOrgId) { + return deptMapper.selectDeptByKingdeeOrgId(kingdeeOrgId); + } + + /** + * 查询部门管理数据 + * + * @param dept 部门信息 + * @return 部门信息集合 + */ + @DataScope(deptAlias = "d") + @Override + public List selectDeptList(Dept dept) + { + return deptMapper.selectDeptList(dept); + } + + /** + * 查询部门管理数据 + * + * @param dept 部门信息 + * @return 部门信息集合 + */ + @Override + public List selectDeptNotRoleList(Dept dept) { + return deptMapper.selectDeptList(dept); + } + + /** + * 查询部门管理树 + * + * @param dept 部门信息 + * @return 所有部门信息 + */ + @Override + @DataScope(deptAlias = "d") + public List selectDeptTree(Dept dept) + { + List deptList = deptMapper.selectDeptList(dept); + List ztrees = initZtree(deptList); + return ztrees; + } + + @Override + @DataScope(deptAlias = "d") + public List selectDeptTreeNew(Dept dept) + { + List deptList = deptMapper.selectDeptList(dept); + List ztrees = initZtree(deptList); + ztrees = getZtrees(ztrees); + return ztrees; + } + + private List getZtrees(List ztrees) { + if (CollectionUtils.isNotEmpty(ztrees)) { + //拿到深圳市 + Ztree ztree = new Ztree(); + ztree.setpId("0"); + ztree.setId("0"); + ztree.setTitle("深圳市"); + ztree.setName("深圳市"); + ztrees.add(ztree); + //拿到角色区分 + List list = dictDataService.selectDictDataByType("role_tree_zone"); + if (CollectionUtils.isNotEmpty(list)) { + // 进行拆解封装 + List zoneTree = list.stream() + .filter(item -> Objects.equals(item.getDictValue(), "1") || + Objects.equals(item.getDictValue(), "2")) + .map(item -> { + Ztree ztree1 = new Ztree(); + ztree1.setTitle(item.getDictLabel()); + ztree1.setName(item.getDictLabel()); + ztree1.setId(item.getDictValue()); + ztree1.setpId("0"); + return ztree1; + }).collect(Collectors.toList()); + ztrees.addAll(zoneTree); + + //给市值和区挂上深圳市 + ztrees = ztrees.stream() + .peek(i -> i.setpId(Objects.equals(i.getZone(), 1) || + Objects.equals(i.getZone(), 2) ? String.valueOf(i.getZone()) : i.getpId())) + .collect(Collectors.toList()); + + + List collect = ztrees.stream() + .filter(item -> Objects.equals(item.getZone(), 2)) + .map(Ztree::getId).collect(Collectors.toList()); + for (String pid : collect) { + //给区直挂上区直 + Ztree ztree1 = new Ztree(); + ztree1.setTitle("区直"); + ztree1.setName("区直"); + ztree1.setId(pid+"3"); + ztree1.setpId(pid); + ztrees.add(ztree1); + // + for (Ztree ztree2 : ztrees) { + if (Objects.equals(ztree2.getZone(), 3) && + StringUtils.isNotEmpty(ztree2.getAncestors()) && ztree2.getAncestors().contains(pid)) { + ztree2.setpId(ztree1.getId()); + } + } + } + } + } + return ztrees; + } + + @Override + public List selectDeptTreeNotRole(Dept dept) + { + List deptList = deptMapper.selectDeptList(dept); + List ztrees = initZtree(deptList); + return ztrees; + } + + /** + * 根据角色ID查询部门(数据权限) + * + * @param role 角色对象 + * @return 部门列表(数据权限) + */ + @Override + public List roleDeptTreeData(Role role) + { + Long roleId = role.getRoleId(); + List ztrees = new ArrayList(); + Dept dept = new Dept(); + dept.setZoneList(role.getZoneList()); + List deptList = selectDeptList(dept); + if (StringUtils.isNotNull(roleId)) + { + List roleDeptList = deptMapper.selectRoleDeptTree(roleId); + ztrees = initZtree(deptList, roleDeptList); + } + else + { + ztrees = initZtree(deptList); + } + if (CollectionUtils.isNotEmpty(role.getZoneList())) { + ztrees = getZtrees(ztrees); + } + return ztrees; + } + + /** + * 对象转部门树 + * + * @param deptList 部门列表 + * @return 树结构列表 + */ + public List initZtree(List deptList) + { + return initZtree(deptList, null); + } + + /** + * 对象转部门树 + * + * @param deptList 部门列表 + * @param roleDeptList 角色已存在菜单列表 + * @return 树结构列表 + */ + public List initZtree(List deptList, List roleDeptList) + { + List ztrees = new ArrayList(); + boolean isCheck = StringUtils.isNotNull(roleDeptList); + for (Dept dept : deptList) + { + if (UserConstants.DEPT_NORMAL.equals(dept.getStatus())) + { + Ztree ztree = new Ztree(); + ztree.setId(dept.getDeptId()); + ztree.setpId(dept.getParentId()); + ztree.setName(dept.getDeptName()); + ztree.setTitle(dept.getDeptName()); + ztree.setAncestors(dept.getAncestors()); + ztree.setZone(dept.getZone()); + if (isCheck) + { + ztree.setChecked(roleDeptList.contains(dept.getDeptId() + dept.getDeptName())); + } + ztrees.add(ztree); + } + } + return ztrees; + } + + /** + * 查询部门人数 + * + * @param parentId 部门ID + * @return 结果 + */ + @Override + public int selectDeptCount(String parentId) + { + Dept dept = new Dept(); + dept.setParentId(parentId); + return deptMapper.selectDeptCount(dept); + } + + /** + * 查询部门是否存在用户 + * + * @param deptId 部门ID + * @return 结果 true 存在 false 不存在 + */ + @Override + public boolean checkDeptExistUser(String deptId) + { + int result = deptMapper.checkDeptExistUser(deptId); + return result > 0 ? true : false; + } + + /** + * 删除部门管理信息 + * + * @param deptId 部门ID + * @return 结果 + */ + @Override + public int deleteDeptById(String deptId) + { + return deptMapper.deleteDeptById(deptId); + } + + /** + * 新增保存部门信息 + * + * @param dept 部门信息 + * @return 结果 + */ + @Override + public int insertDept(Dept dept) + { + Dept info = deptMapper.selectDeptById(dept.getParentId()); + // 如果父节点不为"正常"状态,则不允许新增子节点 + if (!UserConstants.DEPT_NORMAL.equals(info.getStatus())) + { + throw new BusinessException("部门停用,不允许新增"); + } + dept.setCreateBy(ShiroUtils.getLoginName()); + dept.setAncestors(info.getAncestors() + "," + dept.getParentId()); + return deptMapper.insertDept(dept); + } + + /** + * 修改保存部门信息 + * @param dept 部门信息 + * @return 结果 + */ + @Override + @Transactional + public int updateDept(Dept dept) + { + Dept newParentDept = deptMapper.selectDeptById(dept.getParentId()); + Dept oldDept = selectDeptById(dept.getDeptId()); + if (StringUtils.isNotNull(newParentDept) && StringUtils.isNotNull(oldDept)) + { + String newAncestors = newParentDept.getAncestors() + "," + newParentDept.getDeptId(); + String oldAncestors = oldDept.getAncestors(); + dept.setAncestors(newAncestors); + updateDeptChildren(dept.getDeptId(), newAncestors, oldAncestors); + } + dept.setUpdateBy(ShiroUtils.getLoginName()); + int result = deptMapper.updateDept(dept); + + // 判断是否有对应的企业信息, 如果有的话. 需要同时更新企业那边的信息 + + + if (UserConstants.DEPT_NORMAL.equals(dept.getStatus())) + { + // 如果该部门是启用状态,则启用该部门的所有上级部门 + updateParentDeptStatus(dept); + } + return result; + } + + @Override + public int updateDeptName(Dept dept) { + return deptMapper.updateDept(dept); + } + + /** + * 修改该部门的父级部门状态 + * + * @param dept 当前部门 + */ + private void updateParentDeptStatus(Dept dept) + { + String updateBy = dept.getUpdateBy(); + dept = deptMapper.selectDeptById(dept.getDeptId()); + dept.setUpdateBy(updateBy); + deptMapper.updateDeptStatus(dept); + } + + /** + * 修改子元素关系 + * + * @param deptId 被修改的部门ID + * @param newAncestors 新的父ID集合 + * @param oldAncestors 旧的父ID集合 + */ + public void updateDeptChildren(String deptId, String newAncestors, String oldAncestors) + { + List children = deptMapper.selectChildrenDeptById(deptId); + for (Dept child : children) + { + child.setAncestors(child.getAncestors().replace(oldAncestors, newAncestors)); + } + if (children.size() > 0) + { + deptMapper.updateDeptChildren(children); + } + } + + /** + * 修改子元素关系 + * + * @param deptId 部门ID + * @param ancestors 元素列表 + */ + public void updateDeptChildren(String deptId, String ancestors) + { + Dept dept = new Dept(); + dept.setParentId(deptId); + List childrens = deptMapper.selectDeptList(dept); + for (Dept children : childrens) + { + children.setAncestors(ancestors + "," + dept.getParentId()); + } + if (childrens.size() > 0) + { + deptMapper.updateDeptChildren(childrens); + } + } + + /** + * 根据部门ID查询信息 + * + * @param deptId 部门ID + * @return 部门信息 + */ + @Override + public Dept selectDeptById(String deptId) + { + return deptMapper.selectDeptById(deptId); + } + + /** + * 校验部门名称是否唯一 + * + * @param dept 部门信息 + * @return 结果 + */ + @Override + public String checkDeptNameUnique(Dept dept) + { + String deptId = StringUtils.isNull(dept.getDeptId()) ? "-1" : dept.getDeptId(); + Dept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId()); + if (StringUtils.isNotNull(info) && info.getDeptId().equals(deptId)) + { + return UserConstants.DEPT_NAME_NOT_UNIQUE; + } + return UserConstants.DEPT_NAME_UNIQUE; + } + + /** + * 部门数据 不过滤权限 + * @param dept 部门信息 + * @return + */ + @Override + public List selectDeptTreeByNoPermission(Dept dept) { + List deptList = deptMapper.selectDeptListByNoPermission(dept); + List ztrees = initZtree(deptList); + return ztrees; + } + /** + * 查询部门管理数据 + * + * @param dept 部门信息 + * @return 部门信息集合 + */ + @Override + public List selectDeptListNoPermission(Dept dept){ + return deptMapper.selectDeptList(dept); + } + + @Override + public Dept insertSysDeptDefault(SysTenant tenant) { + Dept dept = new Dept(); + //父级部门 + dept.setParentId("0"); + dept.setDeptName(tenant.getTenantName()); + dept.setAncestors("0"); + dept.setTenantCode(tenant.getTenantCode()); + dept.setOrderNum("0"); + dept.setLeader(tenant.getContactMan()); + dept.setPhone(tenant.getContactNumber()); + dept.setCreateBy(ShiroUtils.getLoginName()); + dept.setRemark("租户分配系统自动创建部门"); + deptMapper.insertDept(dept); + return dept; + } + + /** + * 根据部门信息获取当前及一下所有部门(下钻) + * + * @param dept 部门信息 + * @return 部门信息集合 + */ + @Override + public List selectDeptListHole(Dept dept){ + return deptMapper.selectDeptListHole(dept); + } + + + @Override + public Map addSrzDept(JSONArray dataArr,String token) { + int insertNum = 0; + int updateNum = 0; + for (int i = 0; i < dataArr.size(); i++) { + JSONObject jsonObject = dataArr.getJSONObject(i); + if (StringUtils.isEmpty(jsonObject.getString("organizationId"))) { continue; } + + try { + // 返回每条拉取的成功情况 + String taskId = jsonObject.getString("taskId"); + String params = "{\"token\":\"" + token + "\",\"data\":[{\"taskId\":\"" + taskId + "\",\"result\":\"SUCCESS\"}]}"; + String doneStr = connect("/ebus/sfrzhqxglmk/sysDoneTorg", params); + JSONObject doneObj = JSONObject.parseObject(doneStr); + String done = doneObj.getString("success"); + log.info("部门拉取完成结果 ========> :{}", done); + } catch (Exception e) { + log.info("部门数据下拉完成异常,异常任务id:{}",jsonObject.getString("taskId")); + e.printStackTrace(); + } + Dept dept = new Dept(); + dept.setDeptId(jsonObject.getString("organizationId")); + dept.setParentId(jsonObject.getString("parentId")); + dept.setDeptName(jsonObject.getString("name")); + dept.setOrganizationId(jsonObject.getString("organizationId")); + dept.setOrganizationParentId(jsonObject.getString("parentId")); + dept.setZzLevel(Integer.valueOf(jsonObject.getString("zzLevel"))); + dept.setCode(jsonObject.getString("code")); + dept.setMappingUnitParentId(jsonObject.getString("mappingUnitParentId")); + dept.setUpdateAt(jsonObject.getString("updateAt")); + dept.setCreateAt(jsonObject.getString("createAt")); + dept.setDescription(jsonObject.getString("description")); + dept.setEffectOn(jsonObject.getString("effectOn")); + dept.setSequence(jsonObject.getString("sequence")); + dept.setIsDeleted(jsonObject.getString("isDeleted")); + dept.setZzDisplayPath(jsonObject.getString("zzDisplayPath")); + dept.setName(jsonObject.getString("name")); + dept.setGuid(jsonObject.getString("guid")); + dept.setZzIsLeaf(jsonObject.getString("zzIsLeaf")); + dept.setIsDisabled(jsonObject.getString("isDisabled")); + dept.setFullname(jsonObject.getString("fullname")); + dept.setIsMappingUnit(jsonObject.getString("isMappingUnit")); + dept.setSrzUnitId(jsonObject.getString("srzUnitId")); + dept.setTaskId(jsonObject.getString("taskId")); + dept.setSystemId(jsonObject.getString("systemId")); + dept.setCreditcode(jsonObject.getString("creditcode")); + + Dept uniqueDept = deptMapper.selectDeptByOrganizationId(jsonObject.getString("organizationId")); + if (null != uniqueDept && uniqueDept.getOrganizationId() != null) { + // 跟新数据库 + int rowNum = deptMapper.updateDeptByOrganizationId(dept); + updateNum += rowNum; + } else { + // 插入数据库 + int rowNum = deptMapper.insertDept(dept); + insertNum += rowNum; + } + } + Map resMap = new HashedMap(); + resMap.put("insertNum", insertNum); + resMap.put("updateNum", updateNum); + return resMap; + } + + @Override + public List selectDeptAll() + { + return deptMapper.selectDeptAll(); + } + + @Override + public int updateAncestorsById(Dept dept) { + return deptMapper.updateAncestorsById(dept); + } + + + private String connect(String apiPath, String params) { + //各种参数 + + try { +// String params = "{\"uid\":\"5b07b3de672c4e999c4b04f4\"}"; //请求接⼝的参数 + + long now = new Date().getTime(); + String timestamp = Long.toString((long) Math.floor(now / 1000)); + String nonce = Long.toHexString(now) + "-" + Long.toHexString((long) Math.floor(Math.random() * 0xFFFFFF)); + String signature = toSHA256(timestamp + paasToken + nonce + timestamp); + + + //创建CloseableHttpClient + CloseableHttpClient client = HttpClientBuilder.create().build(); + HttpPost httpPost = new HttpPost(znwgUrl + apiPath); + httpPost.setHeader("x-tif-paasid", paasId); + httpPost.setHeader("x-tif-timestamp", timestamp); + httpPost.setHeader("x-tif-signature", signature); + httpPost.setHeader("x-tif-nonce", nonce); + httpPost.setHeader("Content-Type", "application/json"); + httpPost.setHeader("Cache-Control", "no-cache"); + HttpEntity entity = new StringEntity(params); + + + httpPost.setEntity(entity); + + CloseableHttpResponse response = client.execute(httpPost); + + return EntityUtils.toString(response.getEntity()); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + private String toSHA256(String str) throws Exception { + MessageDigest messageDigest; + String encodeStr = ""; + try { + messageDigest = MessageDigest.getInstance("SHA-256"); + messageDigest.update(str.getBytes("UTF-8")); + encodeStr = byte2Hex(messageDigest.digest()); + } catch (Exception e) { + throw e; + } + return encodeStr; + } + + // byte转换成16进制 + private String byte2Hex(byte[] bytes) { + StringBuffer stringBuffer = new StringBuffer(); + String temp = null; + for (int i = 0; i < bytes.length; i++) { + temp = Integer.toHexString(bytes[i] & 0xFF); + if (temp.length() == 1) { + stringBuffer.append("0"); + } + stringBuffer.append(temp); + } + return stringBuffer.toString(); + } + @Override + public List selectDeptByDeptName(String string){ + return deptMapper.selectDeptByDeptName(string); + } + @Override + public Dept selectDeptByDeptName2(String string){ + return deptMapper.selectDeptByDeptName2(string); + } + @Override + public Dept selectDeptByCreditcode(String string){ + return deptMapper.selectDeptByCreditcode(string); + } +} diff --git a/lib/EmergencyService/zdxtEmergencyAuthService/src/main/resources/mapper/system/DictDataMapper.xml b/lib/EmergencyService/zdxtEmergencyAuthService/src/main/resources/mapper/system/DictDataMapper.xml index 597a5b54..0a315e84 100644 --- a/lib/EmergencyService/zdxtEmergencyAuthService/src/main/resources/mapper/system/DictDataMapper.xml +++ b/lib/EmergencyService/zdxtEmergencyAuthService/src/main/resources/mapper/system/DictDataMapper.xml @@ -36,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND status = '0' - order by create_time desc + order by dict_sort @@ -449,19 +455,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and check_category = #{checkCategory} and check_css = #{checkCss} - and DATE_FORMAT(create_time,'%Y-%m-%d') >= STR_TO_DATE(#{beginTime},'%Y-%m-%d') + and DATE_FORMAT(enforcement_time,'%Y-%m-%d') >= STR_TO_DATE(#{beginTime},'%Y-%m-%d') - and DATE_FORMAT(create_time,'%Y-%m-%d') <= STR_TO_DATE(#{endTime},'%Y-%m-%d') + and DATE_FORMAT(enforcement_time,'%Y-%m-%d') <= STR_TO_DATE(#{endTime},'%Y-%m-%d') - AND YEAR(create_time) = #{year} + AND YEAR(enforcement_time) = #{year} - AND QUARTER(create_time) = #{quarter} + AND QUARTER(enforcement_time) = #{quarter} - AND DATE_FORMAT(create_time, '%m') = #{month} + AND DATE_FORMAT(enforcement_time, '%m') = #{month} @@ -478,7 +484,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + and enterprise_name like concat('%', #{enterpriseName}, '%') + and enterprise_number = #{enterpriseNumber} + and enforcement_time = #{enforcementTime} + and law_enforcer = #{lawEnforcer} + and law_enforcer_id = #{lawEnforcerId} + and law_enforcer_other = #{lawEnforcerOther} + and law_enforcer_id_other = #{lawEnforcerIdOther} + and law_enforcement_type = #{lawEnforcementType} + and law_enforcement_type_text = #{lawEnforcementTypeText} + and law_enforcement_item = #{lawEnforcementItem} + and law_enforcement_item_text = #{lawEnforcementItemText} + and law_enforcement_basis = #{lawEnforcementBasis} + and law_enforcement_basis_text = #{lawEnforcementBasisText} + and reslut = #{reslut} + and status = #{status} + and has_delete = #{hasDelete} + and has_complaint = #{hasComplaint} + and has_submit = #{hasSubmit} + and has_evaluate = #{hasEvaluate} + and law_id = #{lawId} + and law_text = #{lawText} + and bureau_dept_id = #{bureauDeptId} + and bureau_dept_name like concat('%', #{bureauDeptName}, '%') + and creditcode = #{creditcode} + and user_id = #{userId} + and dept_id = #{deptId} + + order by create_time desc + + + + + + insert into non_enforcement_registration + + id, + enterprise_name, + enterprise_number, + enforcement_time, + law_enforcer, + law_enforcer_id, + law_enforcer_other, + law_enforcer_id_other, + law_enforcement_type, + law_enforcement_type_text, + law_enforcement_item, + law_enforcement_item_text, + law_enforcement_basis, + law_enforcement_basis_text, + remark, + reslut, + status, + has_delete, + has_complaint, + has_submit, + has_evaluate, + law_id, + law_text, + bureau_dept_id, + bureau_dept_name, + creditcode, + user_id, + dept_id, + create_by, + update_by, + create_time, + update_time, + + + #{id}, + #{enterpriseName}, + #{enterpriseNumber}, + #{enforcementTime}, + #{lawEnforcer}, + #{lawEnforcerId}, + #{lawEnforcerOther}, + #{lawEnforcerIdOther}, + #{lawEnforcementType}, + #{lawEnforcementTypeText}, + #{lawEnforcementItem}, + #{lawEnforcementItemText}, + #{lawEnforcementBasis}, + #{lawEnforcementBasisText}, + #{remark}, + #{reslut}, + #{status}, + #{hasDelete}, + #{hasComplaint}, + #{hasSubmit}, + #{hasEvaluate}, + #{lawId}, + #{lawText}, + #{bureauDeptId}, + #{bureauDeptName}, + #{creditcode}, + #{userId}, + #{deptId}, + #{createBy}, + #{updateBy}, + #{createTime}, + #{updateTime}, + + + + + update non_enforcement_registration + + enterprise_name = #{enterpriseName}, + enterprise_number = #{enterpriseNumber}, + enforcement_time = #{enforcementTime}, + law_enforcer = #{lawEnforcer}, + law_enforcer_id = #{lawEnforcerId}, + law_enforcer_other = #{lawEnforcerOther}, + law_enforcer_id_other = #{lawEnforcerIdOther}, + law_enforcement_type = #{lawEnforcementType}, + law_enforcement_type_text = #{lawEnforcementTypeText}, + law_enforcement_item = #{lawEnforcementItem}, + law_enforcement_item_text = #{lawEnforcementItemText}, + law_enforcement_basis = #{lawEnforcementBasis}, + law_enforcement_basis_text = #{lawEnforcementBasisText}, + remark = #{remark}, + reslut = #{reslut}, + status = #{status}, + has_delete = #{hasDelete}, + has_complaint = #{hasComplaint}, + has_submit = #{hasSubmit}, + has_evaluate = #{hasEvaluate}, + law_id = #{lawId}, + law_text = #{lawText}, + bureau_dept_id = #{bureauDeptId}, + bureau_dept_name = #{bureauDeptName}, + creditcode = #{creditcode}, + user_id = #{userId}, + dept_id = #{deptId}, + create_by = #{createBy}, + update_by = #{updateBy}, + create_time = #{createTime}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from non_enforcement_registration where id = #{id} + + + + delete from non_enforcement_registration where id in + + #{id} + + + + \ No newline at end of file diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/StatisticalPanelMapper.xml b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/StatisticalPanelMapper.xml index f89693bd..77176ea6 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/StatisticalPanelMapper.xml +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/resources/mapper/StatisticalPanelMapper.xml @@ -152,19 +152,19 @@ - and YEAR(r.create_time)=#{year} + and YEAR(r.enforcement_time)=#{year} - and YEAR(r.create_time)=#{year} - and QUARTER(r.create_time)=#{quarter} + and YEAR(r.enforcement_time)=#{year} + and QUARTER(r.enforcement_time)=#{quarter} - and YEAR(r.create_time)=#{year} - and MONTH(r.create_time)=#{month} + and YEAR(r.enforcement_time)=#{year} + and MONTH(r.enforcement_time)=#{month} - and DATE_FORMAT(r.create_time,'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d') - and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(r.create_time,'%Y-%m-%d') + and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d') + and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') @@ -204,19 +204,19 @@ - and YEAR(r.create_time)+1=#{year} + and YEAR(r.enforcement_time)+1=#{year} - and YEAR(DATE_SUB(r.create_time,INTERVAL -1 quarter))=#{year} - and QUARTER(DATE_SUB(r.create_time,INTERVAL -1 quarter))=#{quarter} + and YEAR(DATE_SUB(r.enforcement_time,INTERVAL -1 quarter))=#{year} + and QUARTER(DATE_SUB(r.enforcement_time,INTERVAL -1 quarter))=#{quarter} - and YEAR(DATE_SUB(r.create_time,INTERVAL -1 month))=#{year} - and MONTH(DATE_SUB(r.create_time,INTERVAL -1 month))=#{month} + and YEAR(DATE_SUB(r.enforcement_time,INTERVAL -1 month))=#{year} + and MONTH(DATE_SUB(r.enforcement_time,INTERVAL -1 month))=#{month} - and DATE_FORMAT(r.create_time,'%Y-%m-%d')>=DATE_SUB(STR_TO_DATE(#{beginTime},"%Y-%m-%d"),INTERVAL TO_DAYS(STR_TO_DATE(#{endTime},"%Y-%m-%d"))-TO_DAYS(STR_TO_DATE(#{beginTime},"%Y-%m-%d"))+1 day) - and DATE_SUB(STR_TO_DATE(#{endTime},"%Y-%m-%d"),INTERVAL TO_DAYS(STR_TO_DATE(#{endTime},"%Y-%m-%d"))-TO_DAYS(STR_TO_DATE(#{beginTime},"%Y-%m-%d"))+1 day)>=DATE_FORMAT(r.create_time,'%Y-%m-%d') + and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d')>=DATE_SUB(STR_TO_DATE(#{beginTime},"%Y-%m-%d"),INTERVAL TO_DAYS(STR_TO_DATE(#{endTime},"%Y-%m-%d"))-TO_DAYS(STR_TO_DATE(#{beginTime},"%Y-%m-%d"))+1 day) + and DATE_SUB(STR_TO_DATE(#{endTime},"%Y-%m-%d"),INTERVAL TO_DAYS(STR_TO_DATE(#{endTime},"%Y-%m-%d"))-TO_DAYS(STR_TO_DATE(#{beginTime},"%Y-%m-%d"))+1 day)>=DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') @@ -256,19 +256,19 @@ - and YEAR(r.create_time)+1=#{year} + and YEAR(r.enforcement_time)+1=#{year} - and YEAR(DATE_SUB(r.create_time,INTERVAL -1 year))=#{year} - and QUARTER(DATE_SUB(r.create_time,INTERVAL -1 year))=#{quarter} + and YEAR(DATE_SUB(r.enforcement_time,INTERVAL -1 year))=#{year} + and QUARTER(DATE_SUB(r.enforcement_time,INTERVAL -1 year))=#{quarter} - and YEAR(DATE_SUB(r.create_time,INTERVAL -1 year))=#{year} - and MONTH(DATE_SUB(r.create_time,INTERVAL -1 year))=#{month} + and YEAR(DATE_SUB(r.enforcement_time,INTERVAL -1 year))=#{year} + and MONTH(DATE_SUB(r.enforcement_time,INTERVAL -1 year))=#{month} - and DATE_FORMAT(DATE_SUB(r.create_time,INTERVAL -1 year),'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d') - and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(DATE_SUB(r.create_time,INTERVAL -1 year),'%Y-%m-%d') + and DATE_FORMAT(DATE_SUB(r.enforcement_time,INTERVAL -1 year),'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d') + and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(DATE_SUB(r.enforcement_time,INTERVAL -1 year),'%Y-%m-%d') @@ -299,19 +299,19 @@ - and YEAR(n.create_time)=#{year} + and YEAR(n.check_time)=#{year} - and YEAR(n.create_time)=#{year} - and QUARTER(n.create_time)=#{quarter} + and YEAR(n.check_time)=#{year} + and QUARTER(n.check_time)=#{quarter} - and YEAR(n.create_time)=#{year} - and MONTH(n.create_time)=#{month} + and YEAR(n.check_time)=#{year} + and MONTH(n.check_time)=#{month} - and DATE_FORMAT(n.create_time,'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d') - and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(n.create_time,'%Y-%m-%d') + and DATE_FORMAT(n.check_time,'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d') + and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(n.check_time,'%Y-%m-%d') @@ -341,19 +341,19 @@ - and YEAR(n.create_time)+1=#{year} + and YEAR(n.check_time)+1=#{year} - and YEAR(DATE_SUB(n.create_time,INTERVAL -1 quarter))=#{year} - and QUARTER(DATE_SUB(n.create_time,INTERVAL -1 quarter))=#{quarter} + and YEAR(DATE_SUB(n.check_time,INTERVAL -1 quarter))=#{year} + and QUARTER(DATE_SUB(n.check_time,INTERVAL -1 quarter))=#{quarter} - and YEAR(DATE_SUB(n.create_time,INTERVAL -1 month))=#{year} - and MONTH(DATE_SUB(n.create_time,INTERVAL -1 month))=#{month} + and YEAR(DATE_SUB(n.check_time,INTERVAL -1 month))=#{year} + and MONTH(DATE_SUB(n.check_time,INTERVAL -1 month))=#{month} - and DATE_FORMAT(n.create_time,'%Y-%m-%d')>=DATE_SUB(STR_TO_DATE(#{beginTime},"%Y-%m-%d"),INTERVAL TO_DAYS(STR_TO_DATE(#{endTime},"%Y-%m-%d"))-TO_DAYS(STR_TO_DATE(#{beginTime},"%Y-%m-%d"))+1 day) - and DATE_SUB(STR_TO_DATE(#{endTime},"%Y-%m-%d"),INTERVAL TO_DAYS(STR_TO_DATE(#{endTime},"%Y-%m-%d"))-TO_DAYS(STR_TO_DATE(#{beginTime},"%Y-%m-%d"))+1 day)>=DATE_FORMAT(n.create_time,'%Y-%m-%d') + and DATE_FORMAT(n.check_time,'%Y-%m-%d')>=DATE_SUB(STR_TO_DATE(#{beginTime},"%Y-%m-%d"),INTERVAL TO_DAYS(STR_TO_DATE(#{endTime},"%Y-%m-%d"))-TO_DAYS(STR_TO_DATE(#{beginTime},"%Y-%m-%d"))+1 day) + and DATE_SUB(STR_TO_DATE(#{endTime},"%Y-%m-%d"),INTERVAL TO_DAYS(STR_TO_DATE(#{endTime},"%Y-%m-%d"))-TO_DAYS(STR_TO_DATE(#{beginTime},"%Y-%m-%d"))+1 day)>=DATE_FORMAT(n.check_time,'%Y-%m-%d') @@ -383,19 +383,19 @@ - and YEAR(n.create_time)+1=#{year} + and YEAR(n.check_time)+1=#{year} - and YEAR(DATE_SUB(n.create_time,INTERVAL -1 year))=#{year} - and QUARTER(DATE_SUB(n.create_time,INTERVAL -1 year))=#{quarter} + and YEAR(DATE_SUB(n.check_time,INTERVAL -1 year))=#{year} + and QUARTER(DATE_SUB(n.check_time,INTERVAL -1 year))=#{quarter} - and YEAR(DATE_SUB(n.create_time,INTERVAL -1 year))=#{year} - and MONTH(DATE_SUB(n.create_time,INTERVAL -1 year))=#{month} + and YEAR(DATE_SUB(n.check_time,INTERVAL -1 year))=#{year} + and MONTH(DATE_SUB(n.check_time,INTERVAL -1 year))=#{month} - and DATE_FORMAT(DATE_SUB(n.create_time,INTERVAL -1 year),'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d') - and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(DATE_SUB(n.create_time,INTERVAL -1 year),'%Y-%m-%d') + and DATE_FORMAT(DATE_SUB(n.check_time,INTERVAL -1 year),'%Y-%m-%d') >= DATE_FORMAT(#{beginTime},'%Y-%m-%d') + and DATE_FORMAT(#{endTime},'%Y-%m-%d') >= DATE_FORMAT(DATE_SUB(n.check_time,INTERVAL -1 year),'%Y-%m-%d') @@ -790,10 +790,10 @@ - and DATE_FORMAT(r.create_time,'%Y-%m-%d') >=#{beginTime} + and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') >=#{beginTime} - and DATE_FORMAT(r.create_time,'%Y-%m-%d') #{endTime} + and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') #{endTime} @@ -895,10 +895,10 @@ - and DATE_FORMAT(r.create_time,'%Y-%m-%d') >=#{beginTime} + and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') >=#{beginTime} - and DATE_FORMAT(r.create_time,'%Y-%m-%d') #{endTime} + and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') #{endTime} @@ -956,10 +956,10 @@ - and DATE_FORMAT(r.create_time,'%Y-%m-%d') >=#{beginTime} + and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') >=#{beginTime} - and DATE_FORMAT(r.create_time,'%Y-%m-%d') #{endTime} + and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') #{endTime} @@ -1032,10 +1032,10 @@ - and DATE_FORMAT(r.create_time,'%Y-%m-%d') >=#{beginTime} + and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') >=#{beginTime} - and DATE_FORMAT(r.create_time,'%Y-%m-%d') #{endTime} + and DATE_FORMAT(r.enforcement_time,'%Y-%m-%d') #{endTime} @@ -1107,10 +1107,10 @@ and e.bureau_dept_id in (select sd.dept_id from sys_dept sd where find_in_set(#{deptId}, sd.ancestors) or sd.dept_id = #{deptId}) - and DATE_FORMAT(c.create_time,'%Y-%m-%d') >=#{beginTime} + and DATE_FORMAT(c.enforcement_time,'%Y-%m-%d') >=#{beginTime} - and DATE_FORMAT(c.create_time,'%Y-%m-%d') #{endTime} + and DATE_FORMAT(c.enforcement_time,'%Y-%m-%d') #{endTime} diff --git a/lib/EmergencyServiceApi/emergencyAuthServiceApi/src/main/java/com/zdxt/auth/feign/DeptApi.java b/lib/EmergencyServiceApi/emergencyAuthServiceApi/src/main/java/com/zdxt/auth/feign/DeptApi.java index fb0e56e0..88a828a4 100644 --- a/lib/EmergencyServiceApi/emergencyAuthServiceApi/src/main/java/com/zdxt/auth/feign/DeptApi.java +++ b/lib/EmergencyServiceApi/emergencyAuthServiceApi/src/main/java/com/zdxt/auth/feign/DeptApi.java @@ -127,6 +127,9 @@ public interface DeptApi { */ DeptBean iterationDeptParent(String deptId); + DeptBean iterationDeptParentToBureau(String deptId); + DeptBean iterationDeptParentToBureauGA(String deptId); + /** * 查询当前人所在区 * @param deptId