Browse Source

20210414v1.4

recovery
zy_Java 4 years ago
parent
commit
2ee077b52d
  1. 86
      tall/src/main/java/com/ccsens/tall/service/ExcelService.java
  2. 12
      util/src/test/java/com/ccsens/util/OtherTest.java

86
tall/src/main/java/com/ccsens/tall/service/ExcelService.java

@ -333,7 +333,8 @@ public class ExcelService implements IExcelService {
role.setName(WebConstant.ROLE_NAME.ProjectVirtualRole.value); role.setName(WebConstant.ROLE_NAME.ProjectVirtualRole.value);
role.setDescription(WebConstant.ROLE_NAME.ProjectVirtualRole.phase); role.setDescription(WebConstant.ROLE_NAME.ProjectVirtualRole.phase);
} else { } else {
throw new BaseException(CodeEnum.WBS_NOT_FIRST_ROLE.addMsg(wbsSheet.getSheetName() + i)); throw new BaseException(CodeEnum.WBS_NOT_FIRST_ROLE.addMsg(wbsSheet.getSheetName() + (i+1)));
} }
proRoleService.saveProRole(role); proRoleService.saveProRole(role);
proRoles.add(role); proRoles.add(role);
@ -350,7 +351,7 @@ public class ExcelService implements IExcelService {
// } // }
} }
if (ObjectUtil.isNull(firstRoleId)) { if (ObjectUtil.isNull(firstRoleId)) {
throw new BaseException("找不到系统角色[" + i + "]"); throw new BaseException("找不到系统角色[" + (i + 1) + "]");
} }
//二级角色 //二级角色
if (StrUtil.isNotEmpty(secondRoleCell)) { if (StrUtil.isNotEmpty(secondRoleCell)) {
@ -367,41 +368,61 @@ public class ExcelService implements IExcelService {
try { try {
SysProject project = sysProjectDao.selectByPrimaryKey(Long.parseLong(roleRelevanceProjectId)); SysProject project = sysProjectDao.selectByPrimaryKey(Long.parseLong(roleRelevanceProjectId));
if(ObjectUtil.isNull(project)){ if(ObjectUtil.isNull(project)){
throw new BaseException(CodeEnum.NOT_PROJECT.addMsg(wbsSheet.getSheetName() + i)); throw new BaseException(CodeEnum.NOT_PROJECT.addMsg(wbsSheet.getSheetName() + (i+1)));
} }
proRole.setRelevanceProjectId(project.getId()); proRole.setRelevanceProjectId(project.getId());
}catch (NumberFormatException e){ }catch (NumberFormatException e){
throw new BaseException(CodeEnum.NOT_PROJECT.addMsg(wbsSheet.getSheetName() + i)); throw new BaseException(CodeEnum.NOT_PROJECT.addMsg(wbsSheet.getSheetName() + (i+1)));
} }
} }
proRoleService.saveProRole(proRole); proRoleService.saveProRole(proRole);
proRoles.add(proRole); proRoles.add(proRole);
secondRoleId = proRole.getId(); secondRoleId = proRole.getId();
} else { } else {
throw new BaseException(CodeEnum.WBS_REPEAT_ROLE_NAME.addMsg(wbsSheet.getSheetName() + i)); throw new BaseException(CodeEnum.WBS_REPEAT_ROLE_NAME.addMsg(wbsSheet.getSheetName() + (i+1)));
} }
} }
if (ObjectUtil.isNull(secondRoleId)) { if (ObjectUtil.isNull(secondRoleId)) {
throw new BaseException("找不到二级角色[" + i + "]"); throw new BaseException("找不到二级角色[" + (i+1) + "]");
} }
//添加角色成员关联信息 //添加角色成员关联信息
if (StrUtil.isNotEmpty(memberCell)) { if (StrUtil.isNotEmpty(memberCell)) {
ProMemberRole memberRole = null;
for (ProMember member : proMembers) { String regex = ",|,|;|;|、|/";
if (memberCell.equalsIgnoreCase(member.getNickname())) { String[] split = memberCell.split(regex);
memberRole = new ProMemberRole(); for (int j = 0; j < split.length; j++) {
memberRole.setId(snowflake.nextId()); ProMemberRole memberRole = null;
memberRole.setMemberId(member.getId()); for (ProMember member : proMembers) {
memberRole.setRoleId(secondRoleId); if (split[i].equalsIgnoreCase(member.getNickname())) {
proMemberRoleService.saveMemberRole(memberRole); memberRole = new ProMemberRole();
memberRole.setId(snowflake.nextId());
memberRole.setMemberId(member.getId());
memberRole.setRoleId(secondRoleId);
proMemberRoleService.saveMemberRole(memberRole);
break;
}
}
if (ObjectUtil.isNull(memberRole)) {
throw new BaseException(CodeEnum.WSB_NOT_MEMBER.addMsg(wbsSheet.getSheetName() + (i+1)));
} }
} }
if (ObjectUtil.isNull(memberRole)) { // ProMemberRole memberRole = null;
throw new BaseException(CodeEnum.WSB_NOT_MEMBER.addMsg(wbsSheet.getSheetName() + i)); // for (ProMember member : proMembers) {
} // if (memberCell.equalsIgnoreCase(member.getNickname())) {
}else if (StrUtil.isNotEmpty(roleRelevanceProjectId)) { // memberRole = new ProMemberRole();
// memberRole.setId(snowflake.nextId());
// memberRole.setMemberId(member.getId());
// memberRole.setRoleId(secondRoleId);
// proMemberRoleService.saveMemberRole(memberRole);
// }
// }
// if (ObjectUtil.isNull(memberRole)) {
// throw new BaseException(CodeEnum.WSB_NOT_MEMBER.addMsg(wbsSheet.getSheetName() + (i+1)));
// }
} }
// else if (StrUtil.isNotEmpty(roleRelevanceProjectId)) {
//
// }
} }
//角色对谁不可见 //角色对谁不可见
@ -415,7 +436,8 @@ public class ExcelService implements IExcelService {
String excludeRoleCell = StringUtil.replaceComma(ExcelUtil.getCellValue(row.getCell(4))); String excludeRoleCell = StringUtil.replaceComma(ExcelUtil.getCellValue(row.getCell(4)));
//获取角色对谁不可见 //获取角色对谁不可见
if (StrUtil.isNotEmpty(excludeRoleCell)) { if (StrUtil.isNotEmpty(excludeRoleCell)) {
excludeRoleCells = excludeRoleCell.split(","); String regex = ",|,|;|;|、|/";
excludeRoleCells = excludeRoleCell.split(regex);
Long proRoleId = null; Long proRoleId = null;
if (StrUtil.isNotEmpty(secondRoleCell)) { if (StrUtil.isNotEmpty(secondRoleCell)) {
@ -442,7 +464,7 @@ public class ExcelService implements IExcelService {
} }
} }
if (ObjectUtil.isNull(roleId)) { if (ObjectUtil.isNull(roleId)) {
throw new BaseException(CodeEnum.WBS_NOT_FIND_ROLE.addMsg(wbsSheet.getSheetName() + i)); throw new BaseException(CodeEnum.WBS_NOT_FIND_ROLE.addMsg(wbsSheet.getSheetName() + (i+1)));
} }
} }
excludeRoleService.saveExcludeRole(excludeRole); excludeRoleService.saveExcludeRole(excludeRole);
@ -497,7 +519,7 @@ public class ExcelService implements IExcelService {
//手机号不能为空 //手机号不能为空
if ((StrUtil.isNotEmpty(memberCell) && StrUtil.isEmpty(phoneCell)) || if ((StrUtil.isNotEmpty(memberCell) && StrUtil.isEmpty(phoneCell)) ||
(StrUtil.isNotEmpty(stakeholderCell) && StrUtil.isEmpty(stakeholderPhoneCell))) { (StrUtil.isNotEmpty(stakeholderCell) && StrUtil.isEmpty(stakeholderPhoneCell))) {
throw new BaseException(CodeEnum.WBS_NOT_PHONE.addMsg(memberSheet.getSheetName() + i)); throw new BaseException(CodeEnum.WBS_NOT_PHONE.addMsg(memberSheet.getSheetName() + (i+1)));
} }
//TODO 判断手机号格式 //TODO 判断手机号格式
@ -523,7 +545,7 @@ public class ExcelService implements IExcelService {
proMemberRole.setRoleId(stakeholderId); proMemberRole.setRoleId(stakeholderId);
proMemberRoleService.saveMemberRole(proMemberRole); proMemberRoleService.saveMemberRole(proMemberRole);
} else { } else {
throw new BaseException(CodeEnum.WBS_STAKEHOLDER_PHONE.addMsg(memberSheet.getSheetName() + i)); throw new BaseException(CodeEnum.WBS_STAKEHOLDER_PHONE.addMsg(memberSheet.getSheetName() + (i+1)));
} }
} }
//成员 //成员
@ -546,7 +568,7 @@ public class ExcelService implements IExcelService {
proMembers.add(member); proMembers.add(member);
// //创建者依据project的creatorId判断,不需要添加成员 // //创建者依据project的creatorId判断,不需要添加成员
} else { } else {
throw new BaseException(CodeEnum.WBS_REPEAT_MEMBER_PHONE.addMsg(memberSheet.getSheetName() + i)); throw new BaseException(CodeEnum.WBS_REPEAT_MEMBER_PHONE.addMsg(memberSheet.getSheetName() + (i+1)));
} }
} }
} }
@ -824,7 +846,7 @@ public class ExcelService implements IExcelService {
} }
if (ObjectUtil.isNull(firstTaskDetailId)) { if (ObjectUtil.isNull(firstTaskDetailId)) {
throw new BaseException("找不到任务[" + i + "]"); throw new BaseException("找不到任务[" + (i+1) + "]");
} }
if(StrUtil.isNotEmpty(endTime)){ if(StrUtil.isNotEmpty(endTime)){
@ -879,7 +901,7 @@ public class ExcelService implements IExcelService {
} }
} }
if (ObjectUtil.isNull(executorRoleId)) { if (ObjectUtil.isNull(executorRoleId)) {
throw new BaseException(CodeEnum.WBS_NOT_FIND_EXECUTOR_ROLE.addMsg(wbsSheet.getSheetName() + i)); throw new BaseException(CodeEnum.WBS_NOT_FIND_EXECUTOR_ROLE.addMsg(wbsSheet.getSheetName() + (i+1)));
} }
} }
//检查人 //检查人
@ -893,7 +915,7 @@ public class ExcelService implements IExcelService {
} }
} }
if (ObjectUtil.isNull(checkerRoleId)) { if (ObjectUtil.isNull(checkerRoleId)) {
throw new BaseException(CodeEnum.WBS_NOT_FIND_CHECKER_ROLE.addMsg(wbsSheet.getSheetName() + i)); throw new BaseException(CodeEnum.WBS_NOT_FIND_CHECKER_ROLE.addMsg(wbsSheet.getSheetName() + (i+1)));
} }
} }
//奖惩金额 //奖惩金额
@ -909,7 +931,7 @@ public class ExcelService implements IExcelService {
} else if (delay.equals(WebConstant.TASK_DELAY.Manual.phase)) { } else if (delay.equals(WebConstant.TASK_DELAY.Manual.phase)) {
taskDetail.setDelay((byte) WebConstant.TASK_DELAY.Manual.value); taskDetail.setDelay((byte) WebConstant.TASK_DELAY.Manual.value);
} else { } else {
throw new BaseException(CodeEnum.WBS_DELAY_ERROR.addMsg(wbsSheet.getSheetName() + i)); throw new BaseException(CodeEnum.WBS_DELAY_ERROR.addMsg(wbsSheet.getSheetName() + (i+1)));
} }
} }
//延迟时间 //延迟时间
@ -932,7 +954,7 @@ public class ExcelService implements IExcelService {
//输入文档 新的 //输入文档 新的
if(StrUtil.isNotEmpty(inputFiles)){ if(StrUtil.isNotEmpty(inputFiles)){
String regex=",|,|;|:|;|:|、|。"; String regex=",|,|;|;|、|/";
String[] fileNames= inputFiles.split(regex); String[] fileNames= inputFiles.split(regex);
if(fileNames.length>0){ if(fileNames.length>0){
taskDeliverService.saveProTaskInputDoc(fileNames,taskDetail.getId()); taskDeliverService.saveProTaskInputDoc(fileNames,taskDetail.getId());
@ -989,7 +1011,7 @@ public class ExcelService implements IExcelService {
wbsSubSheetService.getSubTaskMt(xssfWorkbook, subTaskCell, taskDetail, taskDetails, proMembers, deliver, hasGroupMap); wbsSubSheetService.getSubTaskMt(xssfWorkbook, subTaskCell, taskDetail, taskDetails, proMembers, deliver, hasGroupMap);
break; break;
default: default:
// throw new BaseException(CodeEnum.WBS_SUB_TASK_ANALYSIS.addMsg(wbsSheet.getSheetName() + i)); // throw new BaseException(CodeEnum.WBS_SUB_TASK_ANALYSIS.addMsg(wbsSheet.getSheetName() + (i+1)));
wbsSubSheetService.getSubTask(xssfWorkbook, subTaskCell, taskDetail, taskDetails, proMembers, deliver, hasGroupMap); wbsSubSheetService.getSubTask(xssfWorkbook, subTaskCell, taskDetail, taskDetails, proMembers, deliver, hasGroupMap);
} }
} }
@ -1214,7 +1236,7 @@ public class ExcelService implements IExcelService {
// taskDeliverService.saveDeliver(taskDeliver); // taskDeliverService.saveDeliver(taskDeliver);
// } // }
// } // }
String regex=",|,|;|:|;|:|、|。"; String regex=",|,|;|;|、|/";
deliverCell= deliverCell.replace("\n","").replace("\r",""); deliverCell= deliverCell.replace("\n","").replace("\r","");
String[] fileNames= deliverCell.split(regex); String[] fileNames= deliverCell.split(regex);
if(fileNames.length>0){ if(fileNames.length>0){
@ -1296,7 +1318,7 @@ public class ExcelService implements IExcelService {
} }
} }
if (ObjectUtil.isNull(sysPluginId)) { if (ObjectUtil.isNull(sysPluginId)) {
throw new BaseException(CodeEnum.WBS_NOT_PLUGIN.addMsg(sheet.getSheetName() + i)); throw new BaseException(CodeEnum.WBS_NOT_PLUGIN.addMsg(sheet.getSheetName() + (i+1)));
} }
if (CollectionUtil.isNotEmpty(taskNameList)) { if (CollectionUtil.isNotEmpty(taskNameList)) {
for (ProTaskDetail taskName : taskNameList) { for (ProTaskDetail taskName : taskNameList) {

12
util/src/test/java/com/ccsens/util/OtherTest.java

@ -129,6 +129,18 @@ public class OtherTest {
public void test8(){ public void test8(){
System.out.println(Byte.parseByte("-1") & 0xff); System.out.println(Byte.parseByte("-1") & 0xff);
} }
@Test
public void test9(){
String a = "a,b,c";
String x = "a";
String[] split = a.split(",");
String[] split1 = x.split(",");
System.out.println(split);
System.out.println(split1);
}
// //
// /** // /**
// * 发送https请求 // * 发送https请求

Loading…
Cancel
Save