Compare commits
2 Commits
ed3b04b6d5
...
1dcce55d72
Author | SHA1 | Date |
---|---|---|
youHong.ai | 1dcce55d72 | |
youHong.ai | e22366fdc5 |
|
@ -36,6 +36,7 @@ DirectoryV2.xml
|
|||
/lib/classbeanLib/ecology-dev-lib.jar
|
||||
/lib/classbeanLib/web-inf-class-lib.jar
|
||||
/lib/weaverLib/
|
||||
/lib/jitulib/
|
||||
*.groovy
|
||||
*.log
|
||||
*.iml
|
||||
|
@ -46,5 +47,5 @@ src/test/resources/font
|
|||
src/main/resources/WEB-INF/vm/outFile
|
||||
target/
|
||||
*.back
|
||||
src/main/old_src/
|
||||
|
||||
src/main/aiyh_old_src/
|
||||
src/main/jitu_src/
|
|
@ -15,6 +15,7 @@ import weaver.soa.workflow.request.RequestInfo;
|
|||
import weaver.youhong.ai.pcn.actioin.generateloginid.mapper.GenerateLoginIdMapper;
|
||||
|
||||
import java.text.NumberFormat;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -57,9 +58,11 @@ public class GenerateLoginIdAction extends SafeCusBaseAction {
|
|||
Map<String, String> mainTableValue = super.getMainTableValue(requestInfo);
|
||||
String subCompanyName = mainTableValue.get(subCompanyTextField);
|
||||
String subCompanyId = mapper.selectSubCompanyIdBySubCompanyName(subCompanyName);
|
||||
Map<String, String> lastLoginIdInfo = mapper.selectLastLoginId(subCompanyName, subCompanyId, subCompanyName + "%");
|
||||
String loginIdNo = lastLoginIdInfo.get("loginIdNo");
|
||||
String loginId = prefixFill(loginIdNo, subCompanyName);
|
||||
// Map<String, String> lastLoginIdInfo = mapper.selectLastLoginId(subCompanyName, subCompanyId, subCompanyName + "%");
|
||||
// String loginIdNo = lastLoginIdInfo.get("loginIdNo");
|
||||
// String loginId = prefixFill(loginIdNo, subCompanyName);
|
||||
List<String> loginIdList = mapper.selectLoginIdList(subCompanyId);
|
||||
String loginId = subCompanyName + formatList(loginIdList, Integer.parseInt(numberFillQuantity));
|
||||
if (mapper.updateLoginId(billTable, requestId, loginId, loginIdField)) {
|
||||
try {
|
||||
Thread.sleep(500);
|
||||
|
@ -74,6 +77,48 @@ public class GenerateLoginIdAction extends SafeCusBaseAction {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* <h2>前缀补齐</h2>
|
||||
*
|
||||
* @param list 登录名编号
|
||||
* @param length 前缀
|
||||
* @return 登录名
|
||||
*/
|
||||
public String formatList(List<String> list, int length) {
|
||||
NumberFormat format = NumberFormat.getInstance();
|
||||
format.setMinimumIntegerDigits(length);
|
||||
format.setGroupingUsed(false);
|
||||
if (list == null || list.isEmpty()) {
|
||||
return format.format(0);
|
||||
}
|
||||
int maxNum = 0;
|
||||
for (String s : list) {
|
||||
if (s != null && !s.isEmpty()) {
|
||||
int num = 0;
|
||||
boolean foundNum = false;
|
||||
// 从末尾向前读取
|
||||
for (int i = s.length() - 1; i >= 0; i--) {
|
||||
char c = s.charAt(i);
|
||||
if (Character.isDigit(c)) {
|
||||
foundNum = true;
|
||||
int digit = c - '0';
|
||||
// 根据数字位数计算数字大小
|
||||
num += digit * Math.pow(10, s.length() - i - 1);
|
||||
} else if (foundNum) {
|
||||
// 遇到非数字字符,停止读取
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (num > maxNum) {
|
||||
maxNum = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return format.format(maxNum + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* <h2>前缀补齐</h2>
|
||||
*
|
||||
|
|
|
@ -5,6 +5,7 @@ import aiyh.utils.annotation.recordset.Select;
|
|||
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||
import aiyh.utils.annotation.recordset.Update;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -47,6 +48,16 @@ public interface GenerateLoginIdMapper {
|
|||
);
|
||||
|
||||
|
||||
/**
|
||||
* <h2>查询分部下的所有人员登录账号</h2>
|
||||
*
|
||||
* @param subCompanyId 分部id
|
||||
* @return 所有人员登录账号
|
||||
*/
|
||||
@Select("select LOGINID from hrmresource where SUBCOMPANYID1 = #{subCompanyId}")
|
||||
List<String> selectLoginIdList(@ParamMapper("subCompanyId") String subCompanyId);
|
||||
|
||||
|
||||
/**
|
||||
* <h2>更新流程中的loginId字段</h2>
|
||||
*
|
||||
|
|
|
@ -27,6 +27,7 @@ import youhong.ai.pcn.pojo.Student;
|
|||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.*;
|
||||
|
||||
import static com.alibaba.fastjson.JSON.parseObject;
|
||||
|
@ -257,5 +258,42 @@ public class UtilTest extends BaseTest {
|
|||
|
||||
@Test
|
||||
public void testOaNum() {
|
||||
out.println(formatList(Arrays.asList("PCN2P000001", "PCNS0000002", "PDJA000003", "PDC0000405"), 10));
|
||||
}
|
||||
|
||||
public static String formatList(List<String> list, int length) {
|
||||
NumberFormat format = NumberFormat.getInstance();
|
||||
format.setMinimumIntegerDigits(length);
|
||||
format.setGroupingUsed(false);
|
||||
if (list == null || list.isEmpty()) {
|
||||
return format.format(0);
|
||||
}
|
||||
int maxNum = 0;
|
||||
for (String s : list) {
|
||||
if (s != null && !s.isEmpty()) {
|
||||
int num = 0;
|
||||
boolean foundNum = false;
|
||||
// 从末尾向前读取
|
||||
for (int i = s.length() - 1; i >= 0; i--) {
|
||||
char c = s.charAt(i);
|
||||
if (Character.isDigit(c)) {
|
||||
foundNum = true;
|
||||
int digit = c - '0';
|
||||
// 根据数字位数计算数字大小
|
||||
num += digit * Math.pow(10, s.length() - i - 1);
|
||||
} else if (foundNum) {
|
||||
// 遇到非数字字符,停止读取
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (num > maxNum) {
|
||||
maxNum = num;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return format.format(maxNum + 1);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue