Merge branch 'apps_dev' of https://e.coding.net/yilidev/yilipalkaifa/apps into apps_dev
This commit is contained in:
commit
1c63df09b7
Binary file not shown.
@ -0,0 +1,45 @@
|
|||||||
|
package com.actionsoft.apps.coe.pal.datamigration;
|
||||||
|
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.web.RoleErrorWeb;
|
||||||
|
import com.actionsoft.bpms.server.UserContext;
|
||||||
|
import com.actionsoft.bpms.server.bind.annotation.Controller;
|
||||||
|
import com.actionsoft.bpms.server.bind.annotation.Mapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色图错误数据版本合并(1个流程的多个版本对应多个角色图,修正角色图的versionId以及角色图的使用状态)
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
public class RoleErrorChangeController {
|
||||||
|
|
||||||
|
@Mapping("com.actionsoft.apps.coe.pal.datamigration_role_versionid_error_query")
|
||||||
|
public String roleVersionIdErrorDataQuery(UserContext userContext) {
|
||||||
|
return new RoleErrorWeb(userContext).getRoleVersionIdError();
|
||||||
|
}
|
||||||
|
@Mapping("com.actionsoft.apps.coe.pal.datamigration_role_versionid_error_update")
|
||||||
|
public String roleVersionIdErrorDataUpdate(UserContext userContext) {
|
||||||
|
return new RoleErrorWeb(userContext).updateRoleVersionIdError();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mapping("com.actionsoft.apps.coe.pal.datamigration_role_use_error_query")
|
||||||
|
public String roleUseErrorDataQuery(UserContext userContext) {
|
||||||
|
return new RoleErrorWeb(userContext).getRoleUseError();
|
||||||
|
}
|
||||||
|
@Mapping("com.actionsoft.apps.coe.pal.datamigration_role_use_error_update")
|
||||||
|
public String roleUseErrorDataUpdate(UserContext userContext) {
|
||||||
|
return new RoleErrorWeb(userContext).updateRoleUseError();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mapping("com.actionsoft.apps.coe.pal.datamigration_role_ver_error_query")
|
||||||
|
public String roleVerErrorDataQuery(UserContext userContext) {
|
||||||
|
return new RoleErrorWeb(userContext).getRoleVerError();
|
||||||
|
}
|
||||||
|
@Mapping("com.actionsoft.apps.coe.pal.datamigration_role_ver_error_update")
|
||||||
|
public String roleVerErrorDataUpdate(UserContext userContext) {
|
||||||
|
return new RoleErrorWeb(userContext).updateRoleVerError();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Mapping("com.actionsoft.apps.coe.pal.datamigration_role_multi_error_query")
|
||||||
|
public String roleMultiErrorDataUpdate(UserContext userContext) {
|
||||||
|
return new RoleErrorWeb(userContext).updateRoleMultiError();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,151 @@
|
|||||||
|
package com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dao;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dto.RoleUseUpdateDTO;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dto.RoleVerUpdateDTO;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dto.RoleVersionIdUpdateDTO;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepository;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.model.impl.PALRepositoryModelImpl;
|
||||||
|
import com.actionsoft.bpms.util.DBSql;
|
||||||
|
|
||||||
|
public class RolePALRepository extends PALRepository {
|
||||||
|
|
||||||
|
public boolean updateRoleVersionId(List<RoleVersionIdUpdateDTO> roleList) {
|
||||||
|
boolean completeSuccess = false;
|
||||||
|
int index = 0;
|
||||||
|
if (!roleList.isEmpty()) {
|
||||||
|
Connection conn = DBSql.open();
|
||||||
|
PreparedStatement ps = null;
|
||||||
|
ResultSet rset = null;
|
||||||
|
try {
|
||||||
|
conn.setAutoCommit(false);
|
||||||
|
String sql = "UPDATE " + PALRepositoryModelImpl.DATABASE_ENTITY + " set " + PALRepositoryModelImpl.FIELD_PL_VERSION_UUID + "=? where " + PALRepositoryModelImpl.FIELD_UUID + "=?";
|
||||||
|
ps = conn.prepareStatement(sql);
|
||||||
|
for (RoleVersionIdUpdateDTO role : roleList) {
|
||||||
|
ps.setString(1, role.getRoleVersionId());
|
||||||
|
ps.setString(2, role.getRoleId());
|
||||||
|
ps.addBatch();
|
||||||
|
System.out.println("[进行][" + (++index) + "/" + roleList.size() + "]将模型[" + role.getRoleId() + "]的versionId更新为[" + role.getRoleVersionId() + "]");
|
||||||
|
}
|
||||||
|
int[] results = ps.executeBatch();
|
||||||
|
for (int i = 0; i < results.length; i++) {
|
||||||
|
if ((results[i] >= 0) || (results[i] == PreparedStatement.SUCCESS_NO_INFO)) {
|
||||||
|
completeSuccess = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (completeSuccess) {
|
||||||
|
conn.commit();
|
||||||
|
PALRepositoryCache.getCache().reload(true);// 直接整体刷缓存
|
||||||
|
} else {
|
||||||
|
conn.rollback();
|
||||||
|
PALRepositoryCache.getCache().reload(true);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
try {
|
||||||
|
conn.rollback();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
DBSql.close(conn, ps, rset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return completeSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateRoleUse(List<RoleUseUpdateDTO> roleList) {
|
||||||
|
boolean completeSuccess = false;
|
||||||
|
int index = 0;
|
||||||
|
if (!roleList.isEmpty()) {
|
||||||
|
Connection conn = DBSql.open();
|
||||||
|
PreparedStatement ps = null;
|
||||||
|
ResultSet rset = null;
|
||||||
|
try {
|
||||||
|
conn.setAutoCommit(false);
|
||||||
|
String sql = "UPDATE " + PALRepositoryModelImpl.DATABASE_ENTITY + " set " + PALRepositoryModelImpl.FIELD_IS_USE + "=? where " + PALRepositoryModelImpl.FIELD_UUID + "=?";
|
||||||
|
ps = conn.prepareStatement(sql);
|
||||||
|
for (RoleUseUpdateDTO role : roleList) {
|
||||||
|
ps.setInt(1, role.getUse());
|
||||||
|
ps.setString(2, role.getRoleId());
|
||||||
|
ps.addBatch();
|
||||||
|
System.out.println("[进行][" + (++index) + "/" + roleList.size() + "]将模型[" + role.getRoleId() + "]的使用状态更新为[" + role.getUse() + "]");
|
||||||
|
}
|
||||||
|
int[] results = ps.executeBatch();
|
||||||
|
for (int i = 0; i < results.length; i++) {
|
||||||
|
if ((results[i] >= 0) || (results[i] == PreparedStatement.SUCCESS_NO_INFO)) {
|
||||||
|
completeSuccess = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (completeSuccess) {
|
||||||
|
conn.commit();
|
||||||
|
PALRepositoryCache.getCache().reload(true);// 直接整体刷缓存
|
||||||
|
} else {
|
||||||
|
conn.rollback();
|
||||||
|
PALRepositoryCache.getCache().reload(true);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
try {
|
||||||
|
conn.rollback();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
DBSql.close(conn, ps, rset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return completeSuccess;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean updateRoleVer(List<RoleVerUpdateDTO> roleList) {
|
||||||
|
boolean completeSuccess = false;
|
||||||
|
int index = 0;
|
||||||
|
if (!roleList.isEmpty()) {
|
||||||
|
Connection conn = DBSql.open();
|
||||||
|
PreparedStatement ps = null;
|
||||||
|
ResultSet rset = null;
|
||||||
|
try {
|
||||||
|
conn.setAutoCommit(false);
|
||||||
|
String sql = "UPDATE " + PALRepositoryModelImpl.DATABASE_ENTITY + " set " + PALRepositoryModelImpl.FIELD_PL_VER + "=? where " + PALRepositoryModelImpl.FIELD_UUID + "=?";
|
||||||
|
ps = conn.prepareStatement(sql);
|
||||||
|
for (RoleVerUpdateDTO role : roleList) {
|
||||||
|
ps.setDouble(1, role.getVer());
|
||||||
|
ps.setString(2, role.getRoleId());
|
||||||
|
ps.addBatch();
|
||||||
|
System.out.println("[进行][" + (++index) + "/" + roleList.size() + "]将模型[" + role.getRoleId() + "]的版本号更新为[" + role.getVer() + "]");
|
||||||
|
}
|
||||||
|
int[] results = ps.executeBatch();
|
||||||
|
for (int i = 0; i < results.length; i++) {
|
||||||
|
if ((results[i] >= 0) || (results[i] == PreparedStatement.SUCCESS_NO_INFO)) {
|
||||||
|
completeSuccess = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (completeSuccess) {
|
||||||
|
conn.commit();
|
||||||
|
PALRepositoryCache.getCache().reload(true);// 直接整体刷缓存
|
||||||
|
} else {
|
||||||
|
conn.rollback();
|
||||||
|
PALRepositoryCache.getCache().reload(true);
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
try {
|
||||||
|
conn.rollback();
|
||||||
|
} catch (SQLException e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
DBSql.close(conn, ps, rset);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return completeSuccess;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dto;
|
||||||
|
|
||||||
|
public class RoleUseUpdateDTO {
|
||||||
|
|
||||||
|
private String roleId;
|
||||||
|
private int use;
|
||||||
|
|
||||||
|
public RoleUseUpdateDTO(String roleId, int use) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
this.use = use;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleId(String roleId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getUse() {
|
||||||
|
return use;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUse(int use) {
|
||||||
|
this.use = use;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dto;
|
||||||
|
|
||||||
|
public class RoleVerUpdateDTO {
|
||||||
|
|
||||||
|
private String roleId;
|
||||||
|
private double ver;
|
||||||
|
|
||||||
|
public RoleVerUpdateDTO(String roleId, double ver) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
this.ver = ver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleId(String roleId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getVer() {
|
||||||
|
return ver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVer(double ver) {
|
||||||
|
this.ver = ver;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,28 @@
|
|||||||
|
package com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dto;
|
||||||
|
|
||||||
|
public class RoleVersionIdUpdateDTO {
|
||||||
|
|
||||||
|
private String roleId;
|
||||||
|
private String roleVersionId;
|
||||||
|
|
||||||
|
public RoleVersionIdUpdateDTO(String roleId, String roleVersionId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
this.roleVersionId = roleVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleId(String roleId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleVersionId() {
|
||||||
|
return roleVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleVersionId(String roleVersionId) {
|
||||||
|
this.roleVersionId = roleVersionId;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,120 @@
|
|||||||
|
package com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.vo;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class RoleUseErrorVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private int no;
|
||||||
|
private String processId;
|
||||||
|
private String processName;
|
||||||
|
private String processVersionId;
|
||||||
|
private String processVersion;
|
||||||
|
private String processUse;
|
||||||
|
|
||||||
|
private String roleId;
|
||||||
|
private String roleName;
|
||||||
|
private String roleVersionId;
|
||||||
|
private String roleVersion;
|
||||||
|
private String roleUse;
|
||||||
|
|
||||||
|
public RoleUseErrorVO(String processId, String processName, String processVersionId, String processVersion,String processUse, String roleId, String roleName, String roleVersionId, String roleVersion, String roleUse) {
|
||||||
|
this.processId = processId;
|
||||||
|
this.processName = processName;
|
||||||
|
this.processVersionId = processVersionId;
|
||||||
|
this.processVersion = processVersion;
|
||||||
|
this.processUse = processUse;
|
||||||
|
this.roleId = roleId;
|
||||||
|
this.roleName = roleName;
|
||||||
|
this.roleVersionId = roleVersionId;
|
||||||
|
this.roleVersion = roleVersion;
|
||||||
|
this.roleUse = roleUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessUse() {
|
||||||
|
return processUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessUse(String processUse) {
|
||||||
|
this.processUse = processUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleUse() {
|
||||||
|
return roleUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleUse(String roleUse) {
|
||||||
|
this.roleUse = roleUse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getNo() {
|
||||||
|
return no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNo(int no) {
|
||||||
|
this.no = no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessId() {
|
||||||
|
return processId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessId(String processId) {
|
||||||
|
this.processId = processId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessName() {
|
||||||
|
return processName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessName(String processName) {
|
||||||
|
this.processName = processName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessVersionId() {
|
||||||
|
return processVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessVersionId(String processVersionId) {
|
||||||
|
this.processVersionId = processVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessVersion() {
|
||||||
|
return processVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessVersion(String processVersion) {
|
||||||
|
this.processVersion = processVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleVersionId() {
|
||||||
|
return roleVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleVersionId(String roleVersionId) {
|
||||||
|
this.roleVersionId = roleVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleId(String roleId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleName() {
|
||||||
|
return roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleName(String roleName) {
|
||||||
|
this.roleName = roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleVersion() {
|
||||||
|
return roleVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleVersion(String roleVersion) {
|
||||||
|
this.roleVersion = roleVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,101 @@
|
|||||||
|
package com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.vo;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class RoleVerErrorVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private int no;
|
||||||
|
private String processId;
|
||||||
|
private String processName;
|
||||||
|
private String processVersionId;
|
||||||
|
private String processVersion;
|
||||||
|
|
||||||
|
private String roleId;
|
||||||
|
private String roleName;
|
||||||
|
private String roleVersionId;
|
||||||
|
private String roleVersion;
|
||||||
|
|
||||||
|
public RoleVerErrorVO(String processId, String processName, String processVersionId, String processVersion, String roleId, String roleName, String roleVersionId, String roleVersion) {
|
||||||
|
this.processId = processId;
|
||||||
|
this.processName = processName;
|
||||||
|
this.processVersionId = processVersionId;
|
||||||
|
this.processVersion = processVersion;
|
||||||
|
this.roleId = roleId;
|
||||||
|
this.roleName = roleName;
|
||||||
|
this.roleVersionId = roleVersionId;
|
||||||
|
this.roleVersion = roleVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getNo() {
|
||||||
|
return no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNo(int no) {
|
||||||
|
this.no = no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessId() {
|
||||||
|
return processId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessId(String processId) {
|
||||||
|
this.processId = processId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessName() {
|
||||||
|
return processName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessName(String processName) {
|
||||||
|
this.processName = processName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessVersionId() {
|
||||||
|
return processVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessVersionId(String processVersionId) {
|
||||||
|
this.processVersionId = processVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessVersion() {
|
||||||
|
return processVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessVersion(String processVersion) {
|
||||||
|
this.processVersion = processVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleVersionId() {
|
||||||
|
return roleVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleVersionId(String roleVersionId) {
|
||||||
|
this.roleVersionId = roleVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleId(String roleId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleName() {
|
||||||
|
return roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleName(String roleName) {
|
||||||
|
this.roleName = roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleVersion() {
|
||||||
|
return roleVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleVersion(String roleVersion) {
|
||||||
|
this.roleVersion = roleVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,101 @@
|
|||||||
|
package com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.vo;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class RoleVersionIdErrorVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private int no;
|
||||||
|
private String processId;
|
||||||
|
private String processName;
|
||||||
|
private String processVersionId;
|
||||||
|
private String processVersion;
|
||||||
|
|
||||||
|
private String roleId;
|
||||||
|
private String roleName;
|
||||||
|
private String roleVersionId;
|
||||||
|
private String roleVersion;
|
||||||
|
|
||||||
|
public RoleVersionIdErrorVO(String processId, String processName, String processVersionId, String processVersion, String roleId, String roleName, String roleVersionId, String roleVersion) {
|
||||||
|
this.processId = processId;
|
||||||
|
this.processName = processName;
|
||||||
|
this.processVersionId = processVersionId;
|
||||||
|
this.processVersion = processVersion;
|
||||||
|
this.roleId = roleId;
|
||||||
|
this.roleName = roleName;
|
||||||
|
this.roleVersionId = roleVersionId;
|
||||||
|
this.roleVersion = roleVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public int getNo() {
|
||||||
|
return no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNo(int no) {
|
||||||
|
this.no = no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessId() {
|
||||||
|
return processId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessId(String processId) {
|
||||||
|
this.processId = processId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessName() {
|
||||||
|
return processName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessName(String processName) {
|
||||||
|
this.processName = processName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessVersionId() {
|
||||||
|
return processVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessVersionId(String processVersionId) {
|
||||||
|
this.processVersionId = processVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProcessVersion() {
|
||||||
|
return processVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProcessVersion(String processVersion) {
|
||||||
|
this.processVersion = processVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleVersionId() {
|
||||||
|
return roleVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleVersionId(String roleVersionId) {
|
||||||
|
this.roleVersionId = roleVersionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleId() {
|
||||||
|
return roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleId(String roleId) {
|
||||||
|
this.roleId = roleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleName() {
|
||||||
|
return roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleName(String roleName) {
|
||||||
|
this.roleName = roleName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRoleVersion() {
|
||||||
|
return roleVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRoleVersion(String roleVersion) {
|
||||||
|
this.roleVersion = roleVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,619 @@
|
|||||||
|
package com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.web;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dao.RolePALRepository;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dto.RoleUseUpdateDTO;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dto.RoleVerUpdateDTO;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.dto.RoleVersionIdUpdateDTO;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.vo.RoleUseErrorVO;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.vo.RoleVerErrorVO;
|
||||||
|
import com.actionsoft.apps.coe.pal.datamigration.roleErrorChange.vo.RoleVersionIdErrorVO;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.ws.dao.CoeWorkSpace;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.ws.model.CoeWorkSpaceModel;
|
||||||
|
import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil;
|
||||||
|
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
|
||||||
|
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||||
|
import com.actionsoft.bpms.server.UserContext;
|
||||||
|
import com.actionsoft.bpms.util.UtilString;
|
||||||
|
|
||||||
|
public class RoleErrorWeb extends ActionWeb {
|
||||||
|
|
||||||
|
UserContext _uc;
|
||||||
|
public RoleErrorWeb(UserContext uc) {
|
||||||
|
super(uc);
|
||||||
|
_uc = uc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询错误角色数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getRoleVersionIdError() {
|
||||||
|
/*
|
||||||
|
1.查询启动中的资产库
|
||||||
|
2.查询所有的流程
|
||||||
|
3.进行流程分组(按版本)
|
||||||
|
4.计算每个流程涉及到的角色
|
||||||
|
5.剔除不符合要求的流程
|
||||||
|
6.构造结果(结果明细以及结果总数)
|
||||||
|
*/
|
||||||
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
|
|
||||||
|
List<RoleVersionIdErrorVO> errorList = new ArrayList<>();
|
||||||
|
|
||||||
|
List<PALRepositoryModel> allModelList = getAllModelList();// 所有模型
|
||||||
|
|
||||||
|
Map<String, List<PALRepositoryModel>> versionIdModelMap = getProcessModelListMap(allModelList);// 流程
|
||||||
|
Map<String, List<PALRepositoryModel>> roleExt2ModelMap = getRoleModelListMap(allModelList);// 角色
|
||||||
|
|
||||||
|
List data = new ArrayList<>();
|
||||||
|
data.add(0, "org.role");
|
||||||
|
data.add(1, "");
|
||||||
|
// 每个流程进行角色查找判断
|
||||||
|
for (Map.Entry<String, List<PALRepositoryModel>> entry : versionIdModelMap.entrySet()) {
|
||||||
|
String versionId = entry.getKey();
|
||||||
|
List<PALRepositoryModel> modelList = entry.getValue();
|
||||||
|
List<PALRepositoryModel> roleModelList = new ArrayList<>();
|
||||||
|
Map<String, List<PALRepositoryModel> > processIdRoleModelMap = new HashMap<>();
|
||||||
|
for (PALRepositoryModel processModel : modelList) {
|
||||||
|
data.set(1, processModel.getId());
|
||||||
|
String roleKey = data.toString();
|
||||||
|
if (roleExt2ModelMap.containsKey(roleKey)) {
|
||||||
|
roleModelList.addAll(roleExt2ModelMap.get(roleKey));
|
||||||
|
processIdRoleModelMap.put(processModel.getId(), roleExt2ModelMap.get(roleKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Set<String> roleVerIdSet = roleModelList.stream().map(PALRepositoryModel::getVersionId).collect(Collectors.toSet());
|
||||||
|
if (roleVerIdSet.size()>1) {
|
||||||
|
// 流程对应的角色出现多个版本,是错误数据
|
||||||
|
for (PALRepositoryModel processModel : modelList) {
|
||||||
|
String processName = processModel.getName();
|
||||||
|
String processId = processModel.getId();
|
||||||
|
String processVerId = processModel.getVersionId();
|
||||||
|
String processVer = VersionUtil.getVersionStrV(processModel.getVersion());
|
||||||
|
if (processIdRoleModelMap.containsKey(processId)) {
|
||||||
|
List<PALRepositoryModel> roleModelList2 = processIdRoleModelMap.get(processId);
|
||||||
|
for (PALRepositoryModel roleModel : roleModelList2) {
|
||||||
|
String roleId = roleModel.getId();
|
||||||
|
String roleName = roleModel.getName();
|
||||||
|
String roleVerId = roleModel.getVersionId();
|
||||||
|
String roleVer = VersionUtil.getVersionStrV(roleModel.getVersion());
|
||||||
|
errorList.add(new RoleVersionIdErrorVO(processId, processName, processVerId, processVer, roleId, roleName, roleVerId, roleVer));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
errorList.add(new RoleVersionIdErrorVO(processId, processName, processVerId, processVer, "", "", "", ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int updateDataCount = 0;
|
||||||
|
if (errorList.size() > 0) {
|
||||||
|
errorList.sort((o1, o2) -> {
|
||||||
|
if (o1.getProcessVersionId().equals(o2.getProcessVersionId())) {
|
||||||
|
if (o1.getProcessId().equals(o2.getProcessId())) {
|
||||||
|
return o1.getRoleVersionId().compareTo(o2.getRoleVersionId());
|
||||||
|
} else {
|
||||||
|
return o1.getProcessId().compareTo(o2.getProcessId());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return o1.getProcessVersionId().compareTo(o2.getProcessVersionId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
for (int i = 0; i < errorList.size(); i++) {
|
||||||
|
errorList.get(i).setNo(i+1);
|
||||||
|
if (UtilString.isNotEmpty(errorList.get(i).getRoleId())) {
|
||||||
|
updateDataCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ro.put("list", errorList);
|
||||||
|
ro.put("desc", "共有 " + errorList.size() + " 条错误数据,其中"+ updateDataCount +"条数据需要修正(其他流程不存在角色图,不需要修正)");
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String updateRoleVersionIdError() {
|
||||||
|
List<RoleVersionIdUpdateDTO> updateList = new ArrayList<>();
|
||||||
|
|
||||||
|
List<RoleVersionIdErrorVO> errorList = new ArrayList<>();
|
||||||
|
|
||||||
|
List<PALRepositoryModel> allModelList = getAllModelList();// 所有模型
|
||||||
|
|
||||||
|
Map<String, List<PALRepositoryModel>> versionIdModelMap = getProcessModelListMap(allModelList);// 流程
|
||||||
|
Map<String, List<PALRepositoryModel>> roleExt2ModelMap = getRoleModelListMap(allModelList);// 角色
|
||||||
|
List data = new ArrayList<>();
|
||||||
|
data.add(0, "org.role");
|
||||||
|
data.add(1, "");
|
||||||
|
// 每个流程进行角色查找判断
|
||||||
|
for (Map.Entry<String, List<PALRepositoryModel>> entry : versionIdModelMap.entrySet()) {
|
||||||
|
String versionId = entry.getKey();
|
||||||
|
List<PALRepositoryModel> modelList = entry.getValue();
|
||||||
|
List<PALRepositoryModel> roleModelList = new ArrayList<>();
|
||||||
|
Map<String, List<PALRepositoryModel> > processIdRoleModelMap = new HashMap<>();
|
||||||
|
for (PALRepositoryModel processModel : modelList) {
|
||||||
|
data.set(1, processModel.getId());
|
||||||
|
String roleKey = data.toString();
|
||||||
|
if (roleExt2ModelMap.containsKey(roleKey)) {
|
||||||
|
roleModelList.addAll(roleExt2ModelMap.get(roleKey));
|
||||||
|
processIdRoleModelMap.put(processModel.getId(), roleExt2ModelMap.get(roleKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Set<String> roleVerIdSet = roleModelList.stream().map(PALRepositoryModel::getVersionId).collect(Collectors.toSet());
|
||||||
|
if (roleVerIdSet.size()>1) {
|
||||||
|
List<PALRepositoryModel> roleList = new ArrayList<>();// 待处理的角色
|
||||||
|
String roleVerId = null;
|
||||||
|
// 流程对应的角色出现多个版本,是错误数据
|
||||||
|
for (PALRepositoryModel processModel : modelList) {
|
||||||
|
String processName = processModel.getName();
|
||||||
|
String processId = processModel.getId();
|
||||||
|
String processVerId = processModel.getVersionId();
|
||||||
|
String processVer = VersionUtil.getVersionStrV(processModel.getVersion());
|
||||||
|
if (processIdRoleModelMap.containsKey(processId)) {
|
||||||
|
List<PALRepositoryModel> roleModelList2 = processIdRoleModelMap.get(processId);
|
||||||
|
roleList.addAll(roleModelList2);
|
||||||
|
if (processId.equals(processVerId) && roleModelList2.size()>0) {// 找到流程的id与verId相同的流程,使用对应的角色id作为角色verId
|
||||||
|
roleVerId = roleModelList2.get(0).getVersionId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (roleVerId == null) {// 没找到,可能对应初版流程已删除,使用第一个角色的verId
|
||||||
|
roleList.sort((o1, o2) -> {return o1.getCreateDate().compareTo((o2.getCreateDate()));});
|
||||||
|
roleVerId = roleList.get(0).getVersionId();
|
||||||
|
}
|
||||||
|
if (roleVerId != null) {
|
||||||
|
for (PALRepositoryModel roleModel : roleList) {
|
||||||
|
updateList.add(new RoleVersionIdUpdateDTO(roleModel.getId(), roleVerId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("[开始]开始更新角色图VersionID");
|
||||||
|
String msg = "没有角色需要更新";
|
||||||
|
// 更新角色版本ID
|
||||||
|
if (updateList.size() > 0) {
|
||||||
|
RolePALRepository dao = new RolePALRepository();
|
||||||
|
boolean result = dao.updateRoleVersionId(updateList);
|
||||||
|
if (result) {
|
||||||
|
msg = "已更新" + updateList.size() + "条角色版本ID";
|
||||||
|
} else {
|
||||||
|
msg = "更新角色版本ID失败";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("[提示]" + msg);
|
||||||
|
System.out.println("[完成]完成更新角色图VersionID");
|
||||||
|
ResponseObject ro = ResponseObject.newOkResponse(msg);
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<PALRepositoryModel> getAllModelList() {
|
||||||
|
List<PALRepositoryModel> allModelList = new ArrayList<>();// 所有流程
|
||||||
|
List<CoeWorkSpaceModel> wsList = new CoeWorkSpace().getCoeWorkSpaceModelRecodesNoPage();
|
||||||
|
wsList = wsList.stream().filter(ws -> ws.getWsState() == 0).collect(Collectors.toList());// 筛选启动中
|
||||||
|
for (CoeWorkSpaceModel ws : wsList) {
|
||||||
|
allModelList.addAll(PALRepositoryQueryAPIManager.getInstance().getPalRepositoryModelsByWsId(ws.getUUId()));
|
||||||
|
}
|
||||||
|
return allModelList;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, List<PALRepositoryModel>> getProcessModelListMap(List<PALRepositoryModel> allModelList) {
|
||||||
|
// 筛选流程
|
||||||
|
List<PALRepositoryModel> processList = allModelList.stream().filter(model ->
|
||||||
|
"process.bpmn2".equals(model.getMethodId())
|
||||||
|
|| "process.epc".equals(model.getMethodId())
|
||||||
|
|| "process.evc".equals(model.getMethodId())
|
||||||
|
|| "process.flowchart".equals(model.getMethodId())
|
||||||
|
|| "process.framework".equals(model.getMethodId())
|
||||||
|
|| "process.scheme".equals(model.getMethodId())
|
||||||
|
|| "process.subprocess".equals(model.getMethodId())
|
||||||
|
).collect(Collectors.toList());
|
||||||
|
// 流程分组(按版本)
|
||||||
|
Map<String, List<PALRepositoryModel>> versionIdModelMap = processList.stream()
|
||||||
|
.collect(Collectors.groupingBy(PALRepositoryModel::getVersionId));
|
||||||
|
// 删除 List 为 null、空 或 size=1 的模型
|
||||||
|
versionIdModelMap.entrySet().removeIf(entry -> {
|
||||||
|
List<PALRepositoryModel> list = entry.getValue();
|
||||||
|
return list == null || list.isEmpty() || list.size() == 1;
|
||||||
|
});
|
||||||
|
return versionIdModelMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, List<PALRepositoryModel>> getRoleModelListMap(List<PALRepositoryModel> allModelList) {
|
||||||
|
// 筛选角色
|
||||||
|
List<PALRepositoryModel> roleList = allModelList.stream().filter(model ->
|
||||||
|
"org.role".equals(model.getMethodId())
|
||||||
|
).collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
// 角色分组(按ext2)
|
||||||
|
Map<String, List<PALRepositoryModel>> roleExt2ModelMap = roleList.stream().filter(model -> UtilString.isNotEmpty(model.getExt2()))
|
||||||
|
.collect(Collectors.groupingBy(PALRepositoryModel::getExt2));
|
||||||
|
return roleExt2ModelMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询错误角色使用状态数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getRoleUseError() {
|
||||||
|
/*
|
||||||
|
1.查询启动中的资产库
|
||||||
|
2.查询所有的流程
|
||||||
|
3.进行流程分组(按版本)
|
||||||
|
4.计算每个流程涉及到的角色
|
||||||
|
5.剔除不符合要求的流程
|
||||||
|
6.构造结果(结果明细以及结果总数)
|
||||||
|
*/
|
||||||
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
|
|
||||||
|
List<RoleUseErrorVO> errorList = new ArrayList<>();
|
||||||
|
|
||||||
|
List<PALRepositoryModel> allModelList = getAllModelList();// 所有模型
|
||||||
|
|
||||||
|
Map<String, List<PALRepositoryModel>> versionIdModelMap = getProcessModelListMap(allModelList);// 流程
|
||||||
|
Map<String, List<PALRepositoryModel>> roleExt2ModelMap = getRoleModelListMap(allModelList);// 角色
|
||||||
|
|
||||||
|
List data = new ArrayList<>();
|
||||||
|
data.add(0, "org.role");
|
||||||
|
data.add(1, "");
|
||||||
|
// 每个流程进行角色查找判断
|
||||||
|
for (Map.Entry<String, List<PALRepositoryModel>> entry : versionIdModelMap.entrySet()) {
|
||||||
|
String versionId = entry.getKey();
|
||||||
|
List<PALRepositoryModel> modelList = entry.getValue();
|
||||||
|
List<PALRepositoryModel> roleModelList = new ArrayList<>();
|
||||||
|
Map<String, List<PALRepositoryModel> > processIdRoleModelMap = new HashMap<>();
|
||||||
|
for (PALRepositoryModel processModel : modelList) {
|
||||||
|
data.set(1, processModel.getId());
|
||||||
|
String roleKey = data.toString();
|
||||||
|
if (roleExt2ModelMap.containsKey(roleKey)) {
|
||||||
|
roleModelList.addAll(roleExt2ModelMap.get(roleKey));
|
||||||
|
processIdRoleModelMap.put(processModel.getId(), roleExt2ModelMap.get(roleKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 流程对应的角色使用状态不一致,是错误数据
|
||||||
|
for (PALRepositoryModel processModel : modelList) {
|
||||||
|
String processName = processModel.getName();
|
||||||
|
String processId = processModel.getId();
|
||||||
|
String processVerId = processModel.getVersionId();
|
||||||
|
String processVer = VersionUtil.getVersionStrV(processModel.getVersion());
|
||||||
|
String processUse = processModel.isUse() ? "是" : "否";
|
||||||
|
if (processIdRoleModelMap.containsKey(processId)) {
|
||||||
|
List<PALRepositoryModel> roleModelList2 = processIdRoleModelMap.get(processId);
|
||||||
|
for (PALRepositoryModel roleModel : roleModelList2) {
|
||||||
|
String roleId = roleModel.getId();
|
||||||
|
String roleName = roleModel.getName();
|
||||||
|
String roleVerId = roleModel.getVersionId();
|
||||||
|
String roleVer = VersionUtil.getVersionStrV(roleModel.getVersion());
|
||||||
|
String roleUse = roleModel.isUse() ? "是" : "否";
|
||||||
|
if (processModel.isUse() != roleModel.isUse()) {
|
||||||
|
errorList.add(new RoleUseErrorVO(processId, processName, processVerId, processVer, processUse, roleId, roleName, roleVerId, roleVer, roleUse));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (errorList.size() > 0) {
|
||||||
|
errorList.sort((o1, o2) -> {
|
||||||
|
if (o1.getProcessVersionId().equals(o2.getProcessVersionId())) {
|
||||||
|
if (o1.getProcessId().equals(o2.getProcessId())) {
|
||||||
|
return o1.getRoleVersionId().compareTo(o2.getRoleVersionId());
|
||||||
|
} else {
|
||||||
|
return o1.getProcessId().compareTo(o2.getProcessId());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return o1.getProcessVersionId().compareTo(o2.getProcessVersionId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
for (int i = 0; i < errorList.size(); i++) {
|
||||||
|
errorList.get(i).setNo(i+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ro.put("list", errorList);
|
||||||
|
ro.put("desc", "共有 " + errorList.size() + " 条错误数据");
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修正错误角色使用状态数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String updateRoleUseError() {
|
||||||
|
List<RoleUseUpdateDTO> updateList = new ArrayList<>();
|
||||||
|
|
||||||
|
List<PALRepositoryModel> allModelList = getAllModelList();// 所有模型
|
||||||
|
|
||||||
|
Map<String, List<PALRepositoryModel>> versionIdModelMap = getProcessModelListMap(allModelList);// 流程
|
||||||
|
Map<String, List<PALRepositoryModel>> roleExt2ModelMap = getRoleModelListMap(allModelList);// 角色
|
||||||
|
|
||||||
|
List data = new ArrayList<>();
|
||||||
|
data.add(0, "org.role");
|
||||||
|
data.add(1, "");
|
||||||
|
// 每个流程进行角色查找判断
|
||||||
|
for (Map.Entry<String, List<PALRepositoryModel>> entry : versionIdModelMap.entrySet()) {
|
||||||
|
String versionId = entry.getKey();
|
||||||
|
List<PALRepositoryModel> modelList = entry.getValue();
|
||||||
|
List<PALRepositoryModel> roleModelList = new ArrayList<>();
|
||||||
|
Map<String, List<PALRepositoryModel> > processIdRoleModelMap = new HashMap<>();
|
||||||
|
for (PALRepositoryModel processModel : modelList) {
|
||||||
|
data.set(1, processModel.getId());
|
||||||
|
String roleKey = data.toString();
|
||||||
|
if (roleExt2ModelMap.containsKey(roleKey)) {
|
||||||
|
roleModelList.addAll(roleExt2ModelMap.get(roleKey));
|
||||||
|
processIdRoleModelMap.put(processModel.getId(), roleExt2ModelMap.get(roleKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 流程对应的角色使用状态不一致,是错误数据
|
||||||
|
for (PALRepositoryModel processModel : modelList) {
|
||||||
|
String processName = processModel.getName();
|
||||||
|
String processId = processModel.getId();
|
||||||
|
String processVerId = processModel.getVersionId();
|
||||||
|
String processVer = VersionUtil.getVersionStrV(processModel.getVersion());
|
||||||
|
boolean processUse = processModel.isUse();
|
||||||
|
if (processIdRoleModelMap.containsKey(processId)) {
|
||||||
|
List<PALRepositoryModel> roleModelList2 = processIdRoleModelMap.get(processId);
|
||||||
|
for (PALRepositoryModel roleModel : roleModelList2) {
|
||||||
|
String roleId = roleModel.getId();
|
||||||
|
String roleName = roleModel.getName();
|
||||||
|
String roleVerId = roleModel.getVersionId();
|
||||||
|
String roleVer = VersionUtil.getVersionStrV(roleModel.getVersion());
|
||||||
|
boolean roleUse = roleModel.isUse();
|
||||||
|
if (processUse != roleUse) {
|
||||||
|
updateList.add(new RoleUseUpdateDTO(roleId, processUse ? 1 : 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("[开始]开始更新角色图使用状态");
|
||||||
|
String msg = "没有角色需要更新";
|
||||||
|
// 更新角色版本ID
|
||||||
|
if (updateList.size() > 0) {
|
||||||
|
RolePALRepository dao = new RolePALRepository();
|
||||||
|
boolean result = dao.updateRoleUse(updateList);
|
||||||
|
if (result) {
|
||||||
|
msg = "已更新" + updateList.size() + "条角色使用状态";
|
||||||
|
} else {
|
||||||
|
msg = "更新角色使用状态失败";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("[提示]" + msg);
|
||||||
|
System.out.println("[完成]完成更新角色图使用状态");
|
||||||
|
ResponseObject ro = ResponseObject.newOkResponse(msg);
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色版本号检测
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getRoleVerError() {
|
||||||
|
/*
|
||||||
|
1.查询启动中的资产库
|
||||||
|
2.查询所有的流程
|
||||||
|
3.进行流程分组(按版本)
|
||||||
|
4.计算每个流程涉及到的角色
|
||||||
|
5.剔除不符合要求的流程
|
||||||
|
6.构造结果(结果明细以及结果总数)
|
||||||
|
*/
|
||||||
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
|
|
||||||
|
List<RoleVerErrorVO> errorList = new ArrayList<>();
|
||||||
|
|
||||||
|
List<PALRepositoryModel> allModelList = getAllModelList();// 所有模型
|
||||||
|
|
||||||
|
Map<String, List<PALRepositoryModel>> versionIdModelMap = getProcessModelListMap(allModelList);// 流程
|
||||||
|
Map<String, List<PALRepositoryModel>> roleExt2ModelMap = getRoleModelListMap(allModelList);// 角色
|
||||||
|
|
||||||
|
List data = new ArrayList<>();
|
||||||
|
data.add(0, "org.role");
|
||||||
|
data.add(1, "");
|
||||||
|
// 每个流程进行角色查找判断
|
||||||
|
for (Map.Entry<String, List<PALRepositoryModel>> entry : versionIdModelMap.entrySet()) {
|
||||||
|
String versionId = entry.getKey();
|
||||||
|
List<PALRepositoryModel> modelList = entry.getValue();
|
||||||
|
List<PALRepositoryModel> roleModelList = new ArrayList<>();
|
||||||
|
Map<String, List<PALRepositoryModel> > processIdRoleModelMap = new HashMap<>();
|
||||||
|
for (PALRepositoryModel processModel : modelList) {
|
||||||
|
data.set(1, processModel.getId());
|
||||||
|
String roleKey = data.toString();
|
||||||
|
if (roleExt2ModelMap.containsKey(roleKey)) {
|
||||||
|
roleModelList.addAll(roleExt2ModelMap.get(roleKey));
|
||||||
|
processIdRoleModelMap.put(processModel.getId(), roleExt2ModelMap.get(roleKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 流程对应的角色版本号不一致,是错误数据
|
||||||
|
for (PALRepositoryModel processModel : modelList) {
|
||||||
|
String processName = processModel.getName();
|
||||||
|
String processId = processModel.getId();
|
||||||
|
String processVerId = processModel.getVersionId();
|
||||||
|
String processVer = VersionUtil.getVersionStrV(processModel.getVersion());
|
||||||
|
if (processIdRoleModelMap.containsKey(processId)) {
|
||||||
|
List<PALRepositoryModel> roleModelList2 = processIdRoleModelMap.get(processId);
|
||||||
|
for (PALRepositoryModel roleModel : roleModelList2) {
|
||||||
|
String roleId = roleModel.getId();
|
||||||
|
String roleName = roleModel.getName();
|
||||||
|
String roleVerId = roleModel.getVersionId();
|
||||||
|
String roleVer = VersionUtil.getVersionStrV(roleModel.getVersion());
|
||||||
|
if (!processVer.equals(roleVer)) {
|
||||||
|
errorList.add(new RoleVerErrorVO(processId, processName, processVerId, processVer, roleId, roleName, roleVerId, roleVer));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (errorList.size() > 0) {
|
||||||
|
errorList.sort((o1, o2) -> {
|
||||||
|
if (o1.getProcessVersionId().equals(o2.getProcessVersionId())) {
|
||||||
|
if (o1.getProcessId().equals(o2.getProcessId())) {
|
||||||
|
return o1.getRoleVersionId().compareTo(o2.getRoleVersionId());
|
||||||
|
} else {
|
||||||
|
return o1.getProcessId().compareTo(o2.getProcessId());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return o1.getProcessVersionId().compareTo(o2.getProcessVersionId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
for (int i = 0; i < errorList.size(); i++) {
|
||||||
|
errorList.get(i).setNo(i+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ro.put("list", errorList);
|
||||||
|
ro.put("desc", "共有 " + errorList.size() + " 条错误数据");
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色版本号修正
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String updateRoleVerError() {
|
||||||
|
List<RoleVerUpdateDTO> updateList = new ArrayList<>();
|
||||||
|
|
||||||
|
List<PALRepositoryModel> allModelList = getAllModelList();// 所有模型
|
||||||
|
|
||||||
|
Map<String, List<PALRepositoryModel>> versionIdModelMap = getProcessModelListMap(allModelList);// 流程
|
||||||
|
Map<String, List<PALRepositoryModel>> roleExt2ModelMap = getRoleModelListMap(allModelList);// 角色
|
||||||
|
|
||||||
|
List data = new ArrayList<>();
|
||||||
|
data.add(0, "org.role");
|
||||||
|
data.add(1, "");
|
||||||
|
// 每个流程进行角色查找判断
|
||||||
|
for (Map.Entry<String, List<PALRepositoryModel>> entry : versionIdModelMap.entrySet()) {
|
||||||
|
String versionId = entry.getKey();
|
||||||
|
List<PALRepositoryModel> modelList = entry.getValue();
|
||||||
|
List<PALRepositoryModel> roleModelList = new ArrayList<>();
|
||||||
|
Map<String, List<PALRepositoryModel> > processIdRoleModelMap = new HashMap<>();
|
||||||
|
for (PALRepositoryModel processModel : modelList) {
|
||||||
|
data.set(1, processModel.getId());
|
||||||
|
String roleKey = data.toString();
|
||||||
|
if (roleExt2ModelMap.containsKey(roleKey)) {
|
||||||
|
roleModelList.addAll(roleExt2ModelMap.get(roleKey));
|
||||||
|
processIdRoleModelMap.put(processModel.getId(), roleExt2ModelMap.get(roleKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 流程对应的角色使用状态不一致,是错误数据
|
||||||
|
for (PALRepositoryModel processModel : modelList) {
|
||||||
|
String processName = processModel.getName();
|
||||||
|
String processId = processModel.getId();
|
||||||
|
String processVerId = processModel.getVersionId();
|
||||||
|
String processVer = VersionUtil.getVersionStrV(processModel.getVersion());
|
||||||
|
if (processIdRoleModelMap.containsKey(processId)) {
|
||||||
|
List<PALRepositoryModel> roleModelList2 = processIdRoleModelMap.get(processId);
|
||||||
|
for (PALRepositoryModel roleModel : roleModelList2) {
|
||||||
|
String roleId = roleModel.getId();
|
||||||
|
String roleName = roleModel.getName();
|
||||||
|
String roleVerId = roleModel.getVersionId();
|
||||||
|
String roleVer = VersionUtil.getVersionStrV(roleModel.getVersion());
|
||||||
|
if (!processVer.equals(roleVer)) {
|
||||||
|
updateList.add(new RoleVerUpdateDTO(roleId, processModel.getVersion()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("[开始]开始更新角色图使用状态");
|
||||||
|
String msg = "没有角色需要更新";
|
||||||
|
// 更新角色版本ID
|
||||||
|
if (updateList.size() > 0) {
|
||||||
|
RolePALRepository dao = new RolePALRepository();
|
||||||
|
boolean result = dao.updateRoleVer(updateList);
|
||||||
|
if (result) {
|
||||||
|
msg = "已更新" + updateList.size() + "条角色使用状态";
|
||||||
|
} else {
|
||||||
|
msg = "更新角色使用状态失败";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("[提示]" + msg);
|
||||||
|
System.out.println("[完成]完成更新角色图版本号");
|
||||||
|
ResponseObject ro = ResponseObject.newOkResponse(msg);
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询多余的角色图(出现了1个流程对应多个角色图的数据)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String updateRoleMultiError() {
|
||||||
|
/*
|
||||||
|
1.查询启动中的资产库
|
||||||
|
2.查询所有的流程
|
||||||
|
3.进行流程分组(按版本)
|
||||||
|
4.计算每个流程涉及到的角色
|
||||||
|
5.剔除不符合要求的流程
|
||||||
|
6.构造结果(结果明细以及结果总数)
|
||||||
|
*/
|
||||||
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
|
|
||||||
|
List<RoleVersionIdErrorVO> errorList = new ArrayList<>();
|
||||||
|
|
||||||
|
List<PALRepositoryModel> allModelList = getAllModelList();// 所有模型
|
||||||
|
|
||||||
|
Map<String, List<PALRepositoryModel>> versionIdModelMap = getProcessModelListMap(allModelList);// 流程
|
||||||
|
Map<String, List<PALRepositoryModel>> roleExt2ModelMap = getRoleModelListMap(allModelList);// 角色
|
||||||
|
|
||||||
|
List data = new ArrayList<>();
|
||||||
|
data.add(0, "org.role");
|
||||||
|
data.add(1, "");
|
||||||
|
// 每个流程进行角色查找判断
|
||||||
|
for (Map.Entry<String, List<PALRepositoryModel>> entry : versionIdModelMap.entrySet()) {
|
||||||
|
String versionId = entry.getKey();
|
||||||
|
List<PALRepositoryModel> modelList = entry.getValue();
|
||||||
|
List<PALRepositoryModel> roleModelList = new ArrayList<>();
|
||||||
|
Map<String, List<PALRepositoryModel> > processIdRoleModelMap = new HashMap<>();
|
||||||
|
for (PALRepositoryModel processModel : modelList) {
|
||||||
|
data.set(1, processModel.getId());
|
||||||
|
String roleKey = data.toString();
|
||||||
|
if (roleExt2ModelMap.containsKey(roleKey)) {
|
||||||
|
roleModelList.addAll(roleExt2ModelMap.get(roleKey));
|
||||||
|
processIdRoleModelMap.put(processModel.getId(), roleExt2ModelMap.get(roleKey));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 流程对应的角色图数量多于1个,是错误数据
|
||||||
|
for (PALRepositoryModel processModel : modelList) {
|
||||||
|
String processName = processModel.getName();
|
||||||
|
String processId = processModel.getId();
|
||||||
|
String processVerId = processModel.getVersionId();
|
||||||
|
String processVer = VersionUtil.getVersionStrV(processModel.getVersion());
|
||||||
|
if (processIdRoleModelMap.containsKey(processId)) {
|
||||||
|
List<PALRepositoryModel> roleModelList2 = processIdRoleModelMap.get(processId);
|
||||||
|
if (roleModelList2.size() > 1) {
|
||||||
|
for (PALRepositoryModel roleModel : roleModelList2) {
|
||||||
|
String roleId = roleModel.getId();
|
||||||
|
String roleName = roleModel.getName();
|
||||||
|
String roleVerId = roleModel.getVersionId();
|
||||||
|
String roleVer = VersionUtil.getVersionStrV(roleModel.getVersion());
|
||||||
|
errorList.add(new RoleVersionIdErrorVO(processId, processName, processVerId, processVer, roleId, roleName, roleVerId, roleVer));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (errorList.size() > 0) {
|
||||||
|
errorList.sort((o1, o2) -> {
|
||||||
|
if (o1.getProcessVersionId().equals(o2.getProcessVersionId())) {
|
||||||
|
if (o1.getProcessId().equals(o2.getProcessId())) {
|
||||||
|
return o1.getRoleVersionId().compareTo(o2.getRoleVersionId());
|
||||||
|
} else {
|
||||||
|
return o1.getProcessId().compareTo(o2.getProcessId());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return o1.getProcessVersionId().compareTo(o2.getProcessVersionId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
for (int i = 0; i < errorList.size(); i++) {
|
||||||
|
errorList.get(i).setNo(i+1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ro.put("list", errorList);
|
||||||
|
ro.put("desc", "共有 " + errorList.size() + " 条错误数据");
|
||||||
|
return ro.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -22,8 +22,8 @@
|
|||||||
const production = true;
|
const production = true;
|
||||||
const devUserInfo = {};
|
const devUserInfo = {};
|
||||||
</script>
|
</script>
|
||||||
<script type="module" crossorigin src="../apps/com.actionsoft.apps.coe.pal.datamigration/main/js/entry-index-b37414ad.js"></script>
|
<script type="module" crossorigin src="../apps/com.actionsoft.apps.coe.pal.datamigration/main/js/entry-index-5af1bb51.js"></script>
|
||||||
<link rel="stylesheet" href="../apps/com.actionsoft.apps.coe.pal.datamigration/main/assets/asset-style-240032f4.css">
|
<link rel="stylesheet" href="../apps/com.actionsoft.apps.coe.pal.datamigration/main/assets/asset-style-886f8869.css">
|
||||||
</head>
|
</head>
|
||||||
<body style="margin:0;">
|
<body style="margin:0;">
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|||||||
@ -98,4 +98,18 @@
|
|||||||
<param name="path"/>
|
<param name="path"/>
|
||||||
<param name="logId"/>
|
<param name="logId"/>
|
||||||
</cmd-bean>
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_role_versionid_error_query">
|
||||||
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_role_versionid_error_update">
|
||||||
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_role_use_error_query">
|
||||||
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_role_use_error_update">
|
||||||
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_role_ver_error_query">
|
||||||
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_role_ver_error_update">
|
||||||
|
</cmd-bean>
|
||||||
|
<cmd-bean name="com.actionsoft.apps.coe.pal.datamigration_role_multi_error_query">
|
||||||
|
</cmd-bean>
|
||||||
</aws-actions>
|
</aws-actions>
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user