Commit a3a5b6e4 authored by huyuchen's avatar huyuchen

huyc 项目档案代码提交

parent c8b53d80
package com.yifu.cloud.plus.v1.yifu.archives.constants;
/**
* @author huyc
* @date 2022年06月21日
* <p>
* 档案服务常量
*/
public class ArchivesConstants {
/**
* 复档
*/
public static final String EMP_CONTENT = "复档";
/**
* 复项
*/
public static final String PROJECT_CONTENT = "复项";
/**
* 复档复项
*/
public static final String EMP_PROJECT_CONTENT = "复档复项";
/**
* 减档减项
*/
public static final String REDUCE_EMP_PROJECT_CONTENT = "减档减项";
}
...@@ -243,36 +243,6 @@ public class TEmployeeProject extends BaseEntity { ...@@ -243,36 +243,6 @@ public class TEmployeeProject extends BaseEntity {
@Schema(description ="是否删除 0否/1是") @Schema(description ="是否删除 0否/1是")
private String deleteFlag; private String deleteFlag;
/**
* 创建人id
*/
@Schema(description ="创建人id")
private String createBy;
/**
* 创建人姓名
*/
@Schema(description ="创建人姓名")
private String createName;
/**
* 创建时间
*/
@Schema(description ="创建时间")
private LocalDateTime createTime;
/**
* 更新人id
*/
@Schema(description ="更新人id")
private String updateBy;
/**
* 更新时间
*/
@Schema(description ="更新时间")
private LocalDateTime updateTime;
/** /**
* 备注 * 备注
*/ */
......
...@@ -86,7 +86,6 @@ public class EmployeeProjectVO implements Serializable { ...@@ -86,7 +86,6 @@ public class EmployeeProjectVO implements Serializable {
/** /**
* 合同类型(字典值) * 合同类型(字典值)
*/ */
@NotNull(message = "合同类型不能为空")
@ExcelProperty(value ="合同类型") @ExcelProperty(value ="合同类型")
private String contractType; private String contractType;
......
...@@ -18,8 +18,12 @@ ...@@ -18,8 +18,12 @@
package com.yifu.cloud.plus.v1.yifu.archives.mapper; package com.yifu.cloud.plus.v1.yifu.archives.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 项目档案表 * 项目档案表
...@@ -30,4 +34,17 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -30,4 +34,17 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface TEmployeeProjectMapper extends BaseMapper<TEmployeeProject> { public interface TEmployeeProjectMapper extends BaseMapper<TEmployeeProject> {
void updateExcelEmpProject(@Param("list") List<TEmployeeProject> list);
int insertExcelEmpProject(@Param("list") List<TEmployeeProject> list);
void updateEmpIdById(@Param("list") List<TEmployeeInfo> list);
/**
* 通过部门编码获取最大员工编码
* @param deptNo
* @return
*/
String findEmployeeMaxOnlyNoByDepId(@Param("deptNo") String deptNo);
} }
...@@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -21,6 +21,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.pig4cloud.plugin.excel.vo.ErrorMessage; import com.pig4cloud.plugin.excel.vo.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmpEducationUpdateExcelVo;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO; import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeProjectVO;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
...@@ -42,4 +43,6 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> { ...@@ -42,4 +43,6 @@ public interface TEmployeeProjectService extends IService<TEmployeeProject> {
R deleteEmpPro(TEmployeeProject tEmployeeProject); R deleteEmpPro(TEmployeeProject tEmployeeProject);
R<List<ErrorMessage>> importListAdd(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult, String isAdd); R<List<ErrorMessage>> importListAdd(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult, String isAdd);
R<List<ErrorMessage>> importEmpProjectUpdate(List<EmployeeProjectVO> excelVOList, BindingResult bindingResult);
} }
...@@ -45,4 +45,295 @@ ...@@ -45,4 +45,295 @@
<result property="updateTime" column="UPDATE_TIME"/> <result property="updateTime" column="UPDATE_TIME"/>
<result property="remark" column="REMARK"/> <result property="remark" column="REMARK"/>
</resultMap> </resultMap>
<update id="updateExcelEmpProject" parameterType="java.util.List">
update t_employee_project
<trim prefix="set" suffixOverrides=",">
<trim prefix="EMP_NATRUE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empNatrue!=null">
when ID=#{i.id} then #{i.empNatrue}
</if>
</foreach>
</trim>
<trim prefix="EMP_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empName!=null">
when ID=#{i.id} then #{i.empName}
</if>
</foreach>
</trim>
<trim prefix="EMP_IDCARD =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empIdcard!=null">
when ID=#{i.id} then #{i.empIdcard}
</if>
</foreach>
</trim>
<trim prefix="PROJECT_STATUS =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then 0
</foreach>
</trim>
<trim prefix="UPDATE_TIME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then now()
</foreach>
</trim>
<trim prefix="UPDATE_BY =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.updateBy!=null">
when ID=#{i.id} then #{i.updateBy}
</if>
</foreach>
</trim>
<trim prefix="DEPT_NO =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.deptNo!=null">
when ID=#{i.id} then #{i.deptNo}
</if>
</foreach>
</trim>
<trim prefix="CONTRACT_TYPE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.contractType!=null">
when ID=#{i.id} then #{i.contractType}
</if>
</foreach>
</trim>
<trim prefix="WORKING_HOURS =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.workingHours!=null">
when ID=#{i.id} then #{i.workingHours}
</if>
</foreach>
</trim>
<trim prefix="POST =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.post!=null">
when ID=#{i.id} then #{i.post}
</if>
</foreach>
</trim>
<trim prefix="TRY_PERIOD =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.tryPeriod!=null">
when ID=#{i.id} then #{i.tryPeriod}
</if>
</foreach>
</trim>
<trim prefix="ENJOIN_DATE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.enjoinDate!=null">
when ID=#{i.id} then #{i.enjoinDate}
</if>
</foreach>
</trim>
<trim prefix="BANK_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankName!=null">
when ID=#{i.id} then #{i.bankName}
</if>
</foreach>
</trim>
<trim prefix="BANK_NO =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankNo!=null">
when ID=#{i.id} then #{i.bankNo}
</if>
</foreach>
</trim>
<trim prefix="BANK_SUB_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankSubName!=null">
when ID=#{i.id} then #{i.bankSubName}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
ID=#{i.id}
</foreach>
</update>
<update id="updateExcelEmpProject" parameterType="java.util.List">
update t_employee_project
<trim prefix="set" suffixOverrides=",">
<trim prefix="EMP_NATRUE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empNatrue!=null">
when ID=#{i.id} then #{i.empNatrue}
</if>
</foreach>
</trim>
<trim prefix="EMP_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empName!=null">
when ID=#{i.id} then #{i.empName}
</if>
</foreach>
</trim>
<trim prefix="EMP_IDCARD =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.empIdcard!=null">
when ID=#{i.id} then #{i.empIdcard}
</if>
</foreach>
</trim>
<trim prefix="PROJECT_STATUS =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then 0
</foreach>
</trim>
<trim prefix="UPDATE_TIME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then now()
</foreach>
</trim>
<trim prefix="UPDATE_BY =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.updateBy!=null">
when ID=#{i.id} then #{i.updateBy}
</if>
</foreach>
</trim>
<trim prefix="DEPT_NO =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.deptNo!=null">
when ID=#{i.id} then #{i.deptNo}
</if>
</foreach>
</trim>
<trim prefix="CONTRACT_TYPE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.contractType!=null">
when ID=#{i.id} then #{i.contractType}
</if>
</foreach>
</trim>
<trim prefix="WORKING_HOURS =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.workingHours!=null">
when ID=#{i.id} then #{i.workingHours}
</if>
</foreach>
</trim>
<trim prefix="POST =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.post!=null">
when ID=#{i.id} then #{i.post}
</if>
</foreach>
</trim>
<trim prefix="TRY_PERIOD =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.tryPeriod!=null">
when ID=#{i.id} then #{i.tryPeriod}
</if>
</foreach>
</trim>
<trim prefix="ENJOIN_DATE =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.enjoinDate!=null">
when ID=#{i.id} then #{i.enjoinDate}
</if>
</foreach>
</trim>
<trim prefix="BANK_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankName!=null">
when ID=#{i.id} then #{i.bankName}
</if>
</foreach>
</trim>
<trim prefix="BANK_NO =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankNo!=null">
when ID=#{i.id} then #{i.bankNo}
</if>
</foreach>
</trim>
<trim prefix="BANK_SUB_NAME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.bankSubName!=null">
when ID=#{i.id} then #{i.bankSubName}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
ID=#{i.id}
</foreach>
</update>
<insert id="insertExcelEmpProject" parameterType="java.util.List">
insert into t_employee_project
(ID,EMP_ID,EMP_NATRUE,EMP_NAME,EMP_IDCARD,STATUS,PROJECT_STATUS,EMP_CODE,DEPT_NO,CONTRACT_TYPE,POST,EMP_NO,
TRY_PERIOD,ENJOIN_DATE,BANK_NAME,BANK_NO,BANK_SUB_NAME,DELETE_FLAG,CREATE_BY,CREATE_NAME,CREATE_TIME)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.id,jdbcType=VARCHAR},
#{item.empId,jdbcType=VARCHAR},
#{item.empNatrue,jdbcType=VARCHAR},
#{item.empName,jdbcType=VARCHAR},
#{item.empIdcard,jdbcType=VARCHAR},
#{item.status,jdbcType=VARCHAR},
0,
#{item.empCode,jdbcType=VARCHAR},
#{item.deptNo,jdbcType=VARCHAR},
#{item.contractType,jdbcType=VARCHAR},
#{item.post,jdbcType=VARCHAR},
#{item.empNo,jdbcType=VARCHAR},
#{item.tryPeriod,jdbcType=VARCHAR},
#{item.enjoinDate,jdbcType=DATE},
#{item.bankName,jdbcType=VARCHAR},
#{item.bankNo,jdbcType=VARCHAR},
#{item.bankSubName,jdbcType=VARCHAR},
#{item.deleteFlag,jdbcType=VARCHAR},
#{item.createBy,jdbcType=VARCHAR},
#{item.createName,jdbcType=VARCHAR},
now()
)
</foreach>
</insert>
<!--查询部门编码和最大员工数-->
<select id="findEmployeeMaxOnlyNoByDepId" resultMap="EmployeeNoResultMap">
SELECT
(
SELECT
MAX(EMP_NO)
FROM
t_employee_project
WHERE
DELETE_FLAG = 0
and id not like '%abc'
and
EMP_NO LIKE CONCAT(
(
SELECT
DEPART_NO
FROM
t_settle_domain
WHERE
DEPT_NO = #{deptNo}
),
'%'
)
) AS 'empNo'
FROM
DUAL
</select>
<update id="updateEmpIdById" parameterType="java.util.List">
update t_employee_project
SET EMP_ID = #{i.id}
where
<foreach collection="list" separator="or" item="i" index="index" >
EMP_IDCARD=#{i.empIdcard} AND DEPT_NO =#{i.deptNo}
</foreach>
</update>
</mapper> </mapper>
...@@ -198,4 +198,20 @@ public interface CommonConstants { ...@@ -198,4 +198,20 @@ public interface CommonConstants {
//int 4 //int 4
int FOUR_INT = 4; int FOUR_INT = 4;
String TEN_STRING = "10"; String TEN_STRING = "10";
/**
* 员工初始序列
* @Author pwang
* @Date 2020-05-14 11:13
* @param null
* @return
**/
public static final String EMPLOYEE_INIT_NO = "0001";
/**
* 员工的的前缀位数
* @Author pwang
* @Date 2020-05-14 14:10
**/
public static final int EMPLOYEE_INIT_NO_START = 7;
} }
...@@ -205,4 +205,20 @@ public interface ErrorCodes { ...@@ -205,4 +205,20 @@ public interface ErrorCodes {
* 银行卡号校验传参有误:姓名、身份证号、银行卡号 必填 * 银行卡号校验传参有误:姓名、身份证号、银行卡号 必填
*/ */
String CHECKS_BANK_NO_REQUEST_PARAM_ERROR = "checks.bank.no.request.param.error"; String CHECKS_BANK_NO_REQUEST_PARAM_ERROR = "checks.bank.no.request.param.error";
/**
* 存在已减档的档案和已减项的项目,禁止导入
*/
String CHECKS_EMP_PROJECT_ERROR = "checks.emp.project.error";
/**
* 存在已减档的档案,禁止导入
*/
String CHECKS_REDUCE_EMP_ERROR = "checks.reduce.emp.error";
/**
* 存在已减项的项目,禁止导入
*/
String CHECKS_REDUCE_PROJECT_ERROR = "checks.reduce.project.error";
/**
* 人员不在该项目,无法更新
*/
String CHECKS_EMP_EXIT_ERROR = "checks.emp.exit.error";
} }
package com.yifu.cloud.plus.v1.yifu.common.core.util;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
/**
* @program: master
* @description: 序号生成工具
* @description: 例如三位数的全部序号如下 000~999、A01~A99 ……Z01~Z99,ZA1~ZA9……ZZ1~ZZ9,ZZA~ZZZ
* @author: pwang
* @create: 2020-05-12 09:55
**/
@Slf4j
public class NoUtil {
private static char[] alphatableb = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
'V', 'W', 'X', 'Y', 'Z'};
/**
* 数字加一规则
*
* @Author pwang
* @Date 2020-05-12 14:29
* @param null
* @return
**/
private static Map<String, String> numberMap = new HashMap() {
{
put("0", "1");
put("1", "2");
put("2", "3");
put("3", "4");
put("4", "5");
put("5", "6");
put("6", "7");
put("7", "8");
put("8", "9");
}
};
/**
* 字符加一规则
*
* @Author pwang
* @Date 2020-05-12 14:28
* @param null
* @return
**/
private static Map<String, String> charMap = new HashMap() {
{
put("A", "B");
put("B", "C");
put("C", "D");
put("D", "E");
put("E", "F");
put("F", "G");
put("G", "H");
put("H", "I");
put("I", "J");
put("J", "K");
put("K", "L");
put("L", "M");
put("M", "N");
put("N", "O");
put("O", "P");
put("P", "Q");
put("Q", "R");
put("R", "S");
put("S", "T");
put("T", "U");
put("U", "V");
put("V", "W");
put("W", "X");
put("X", "Y");
put("Y", "Z");
}
};
/**
* @param args
*/
public static void main(String[] args) {
//打印所有流水号
String initStr = "皖A0000";
int maxIntStr = 9999;
String maxStr = "ZZZZ";
NoUtil noUtil = new NoUtil();
long d3 = System.currentTimeMillis();
long i = 0L;
while (!initStr.equals("皖AZZZZ")) {
i++;
initStr = NoUtil.productionNo(initStr,2);
/*log.info(initStr);*/
// 测试断点
if (initStr.equals("皖AZZZZ")) {
break;
}
}
long d4 = System.currentTimeMillis();
long d1 = System.currentTimeMillis();
//重新初始化
long j = 0L;
initStr = "0000";
while (!initStr.equals(maxStr)) {
j++;
initStr = noUtil.algorithm4Code(5, initStr, maxIntStr, maxStr);;
/*log.info(initStr);*/
// 测试断点
if (initStr.equals(maxStr)) {
break;
}
}
long d2 = System.currentTimeMillis();
log.info("2位最大编码数:" + numberCount(2));
log.info("3位最大编码数:" + numberCount(3));
log.info("原方法耗时:" + (d2 - d1));
log.info("原方法编码数:" + String.valueOf(j));
log.info("新方法耗时:" + (d4 - d3));
log.info("新方法编码数:" + String.valueOf(i));
}
/**
* 生成编码算法
*
* @param digit 位数
* @param currentStr 当前流水号
* @param maxIntStr 最大流水号(数字部分)
* @param maxStr 最大流水号
* @return
*/
public String algorithm4Code(int digit, String currentStr, int maxIntStr, String maxStr) {
//流水序号,默认4位
String formatStr1 = "00000";
int maxNum = maxIntStr;
StringBuffer tmpBuff = new StringBuffer();
StringBuffer tmpBuff1 = new StringBuffer();
for (int i = 1; i < digit; i++) {
tmpBuff.append(0);
tmpBuff1.append(9);
}
formatStr1 = tmpBuff.toString() + "0";
maxNum = Integer.parseInt(tmpBuff1.append(9).toString());
String initStr = "";
if (currentStr == null) {
initStr = maxNum + "";
} else {
initStr = currentStr;
}
//找出字符串最后一位字母
int sign = 0;
boolean isfind = false;
for (int i = initStr.length() - 1; i >= 0; i--) {
if (initStr.charAt(i) >= 'A' && initStr.charAt(i) <= 'Z') {
sign = i;
isfind = true;
break;
}
}
//分隔字母和数字
String letterStr = "";
String numStr = "";
if (isfind) {
letterStr = initStr.substring(0, sign + 1);
numStr = initStr.substring(sign + 1);
} else {
numStr = initStr;
}
//如果数字部分不全为9,则直接加一,返回
boolean isAllNine = false;
for (int i = 0; i < numStr.length(); i++) {
if (numStr.charAt(i) == '9') {
isAllNine = true;
} else {
isAllNine = false;
break;
}
}
if (!isAllNine && !"".equals(numStr)) {
int nextNum = Integer.parseInt(numStr) + 1;
return letterStr + supplementNumPrefix(nextNum, numStr.length());
} else {
//数字部分全为9或者数字部分为空,需要分情况分析
String nextNum = "";
if ("".equals(letterStr) && !numStr.equals(String.valueOf(maxIntStr))) {
//字母部分为空
String nineStr = numStr.substring(1);
// nextNum = "A"+restNumberFunc(nineStr);
nextNum = restNumberFunc(nineStr);
} else if (numStr.equals(String.valueOf(maxIntStr))) {
String nineStr = numStr.substring(1);
nextNum = "A" + restNumberFunc(nineStr);
} else {
//字母部分不为空
//判断字母部分的最后一位字母是否有下一位,比如A,则有下一位B,Z则没有。
char lastLetter = letterStr.charAt(letterStr.length() - 1);
int pos = -1;
//顺序查找
for (int i = 0; i < alphatableb.length; i++) {
if (alphatableb[i] == lastLetter) {
pos = i;
break;
}
}
if (pos == -1) {
System.out.println("查找字母出错");
return "error";
}
if ('Z' == alphatableb[pos]) {
//最后一位字母为'Z'
if (!"".equals(numStr)) {
//Z9999
nextNum = letterStr.substring(0, letterStr.length())
+ 'A' + restNumberFunc(numStr.substring(1));
} else {
//ZZZZZ
System.out.println("商户序号已达到最大值,请联系管理员");
return "error";
}
} else {
//最后一位字母不为'Z'
if (!"".equals(numStr)) {
//ZA99
nextNum = letterStr.substring(0, letterStr.length() - 1)
+ alphatableb[pos + 1] + restNumberFunc(numStr);
} else {
//ZZZA
nextNum = letterStr.substring(0, letterStr.length() - 1)
+ alphatableb[pos + 1];
}
}
}
return nextNum;
}
}
/**
* 补充数字前缀
*
* @param nextNum
* @param numLen
* @return
*/
private String supplementNumPrefix(int nextNum, int numLen) {
StringBuffer tmpBuff = new StringBuffer();
for (int i = 0; i < numLen; i++) {
tmpBuff.append(0);
}
DecimalFormat format = new DecimalFormat(tmpBuff.toString());
return format.format(nextNum);
}
/**
* 数据重置函数
*
* @param nineStr
* @return
*/
public String restNumberFunc(String nineStr) {
if ("".equals(nineStr)) return nineStr;
String zeroStr = nineStr.replace('9', '0');
DecimalFormat format = new DecimalFormat(zeroStr);
int firstNum = Integer.parseInt(zeroStr) + 1;
return format.format(firstNum);
}
/**
* 最大序号数量
*
* @param digit 位数
* @return
* @Author pwang
* @Date 2020-05-11 18:17
**/
public static double numberCount(int digit) {
//计算规律 (10^digit-1) + (26*(10^(digit-1)-1)+……+26*(10-1))+ 26
double maxIntStr = Math.pow(10, digit) - 1;
double reuslt = maxIntStr;
for (int i = digit - 1; i > 0; i--) {
reuslt += 26 * (Math.pow(10, i) - 1);
}
return reuslt + 26;
}
/**
* 类似35进制找下一个序号
**/
public String nextNoByMapFor35(String currentStr) throws RuntimeException {
char result[] = currentStr.toCharArray();
boolean resultInfo = false;
String temp = null;
for (int i = result.length - 1; i >= 0; i--) {
if ('Z' != result[i]) {
temp = charMap.get(String.valueOf(result[i]));
Assert.notNull(temp, currentStr.concat("含有非法字符!"));
result[i] = temp.charAt(0);
resultInfo = true;
break;
} else {
temp = charMap.get(String.valueOf(result[i]));
Assert.notNull(temp, currentStr.concat("含有非法字符!"));
result[i] = temp.charAt(0);
}
}
Assert.isTrue(resultInfo, "序号已达到最大值,请联系管理员");
return String.valueOf(result);
}
/**
* 找下一个序号
**/
public static String nextNoByMap(String currentStr) throws RuntimeException {
Assert.isTrue(null != currentStr,"当前串不能为空!");
char result[] = currentStr.toUpperCase().toCharArray();
String temp = null;
for (int i = result.length - 1; i >= 0; i--) {
if ('Z' != result[i]) {
if ('9' == result[i]) {
//进位处理
if (0 == i || 'Z' == result[i - 1]) {
//计算到最高位为9或者下高位是Z本为进位成A
result[i] = 'A';
if (result.length - 1 != i) {
//若本位不是最低位则最低置1
result[result.length - 1] = '1';
}
break;
} else {
result[i] = '0';
}
} else {
temp = numberMap.get(String.valueOf(result[i]));
if (null == temp) {
//查看是不是字符加一
temp = charMap.get(String.valueOf(result[i]));
//字符加一也找不到抛出异常
Assert.isTrue(null != temp, currentStr.concat("含有非法字符!"));
if (result.length - 1 != i) {
//字符加一,若本位不是最低位则最低置1
result[result.length - 1] = '1';
}
}
result[i] = temp.charAt(0);
break;
}
} else {
Assert.isTrue(i != result.length - 1, "序号已达到最大值,请联系管理员");
}
}
return String.valueOf(result);
}
/**
* 开始到starPos保留 + 从第starPos+1开始截取至结尾生产序号
* @Author pwang
* @Date 2020-05-14 9:53
* @param currentStr 当前串
* @param starPos 从第starPos+1开始有效
* @return
**/
public static String productionNo(String currentStr,int starPos){
Assert.isTrue(null != currentStr,"当前串不能为空!");
Assert.isTrue(starPos<currentStr.length(),"当前串共".concat(String.valueOf(currentStr.length())).concat("位,不能从第").concat(String.valueOf(starPos+1)).concat("位截取!"));
return currentStr.substring(0,starPos).concat(NoUtil.nextNoByMap(currentStr.substring(starPos,currentStr.length())));
}
}
...@@ -54,6 +54,12 @@ checks.mobile.request.error=\u6821\u9A8C\u8BF7\u6C42\u5F02\u5E38 ...@@ -54,6 +54,12 @@ checks.mobile.request.error=\u6821\u9A8C\u8BF7\u6C42\u5F02\u5E38
checks.mobile.request.limit.hundred=\u5355\u6B21\u53F7\u7801\u72B6\u6001\u6821\u9A8C\u8BF7\u6C42\u4E0A\u9650100 checks.mobile.request.limit.hundred=\u5355\u6B21\u53F7\u7801\u72B6\u6001\u6821\u9A8C\u8BF7\u6C42\u4E0A\u9650100
checks.bank.no.request.param.error=\u94F6\u884C\u5361\u53F7\u6821\u9A8C\u4F20\u53C2\u6709\u8BEF\uFF1A\u59D3\u540D\u3001\u8EAB\u4EFD\u8BC1\u53F7\u3001\u94F6\u884C\u5361\u53F7 \u5FC5\u586B checks.bank.no.request.param.error=\u94F6\u884C\u5361\u53F7\u6821\u9A8C\u4F20\u53C2\u6709\u8BEF\uFF1A\u59D3\u540D\u3001\u8EAB\u4EFD\u8BC1\u53F7\u3001\u94F6\u884C\u5361\u53F7 \u5FC5\u586B
checks.emp.project.error=\u5B58\u5728\u5DF2\u51CF\u6863\u7684\u6863\u6848\u548C\u5DF2\u51CF\u9879\u7684\u9879\u76EE\uFF0C\u7981\u6B62\u5BFC\u5165
checks.reduce.emp.error=\u5B58\u5728\u5DF2\u51CF\u6863\u7684\u6863\u6848\uFF0C\u7981\u6B62\u5BFC\u5165
checks.reduce.project.error=\u5B58\u5728\u5DF2\u51CF\u9879\u7684\u9879\u76EE\uFF0C\u7981\u6B62\u5BFC\u5165
checks.emp.exit.error=\u4EBA\u5458\u4E0D\u5728\u8BE5\u9879\u76EE\uFF0C\u65E0\u6CD5\u66F4\u65B0
......
...@@ -241,7 +241,7 @@ public class UserController { ...@@ -241,7 +241,7 @@ public class UserController {
* @return R * @return R
*/ */
@SysLog("从ldap中获取用户") @SysLog("从ldap中获取用户")
@PostMapping("inner/updateUser") @PostMapping("/inner/updateUser")
@Inner @Inner
public R innerUpdateByLdap() { public R innerUpdateByLdap() {
return R.ok(userService.updateByLdap()); return R.ok(userService.updateByLdap());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment