张晓波
2023-09-19 164694c47c35d6654df69b533e8dbf8b5423efc5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.thhy.staff.utils;
 
import com.thhy.general.utils.password.PasswdUtils;
import com.thhy.staff.modules.biz.platuser.entity.PlatUser;
import com.thhy.staff.modules.biz.platuser.entity.PlatUserDto;
import com.thhy.staff.modules.biz.platuser.entity.SysUsers;
 
public class StaffNoUtils {
 
    public static String create(int type,Integer maxNo){
        int newMaxNo = maxNo+1;
        String jobnum = "";
        if(String.valueOf(newMaxNo).length()<5){
            String demo = "0000000000";
            jobnum=demo.substring(0,(5-String.valueOf(newMaxNo).length()))+newMaxNo;
        }
        if(type==1){
            return "G"+jobnum;
        }else{
            return "L"+jobnum;
        }
    }
 
    public static SysUsers PlatoSys(PlatUserDto platUserDto){
        SysUsers sysUsers = new SysUsers();
        sysUsers.setRealName(platUserDto.getRealName());
        sysUsers.setSex(platUserDto.getSex());
        sysUsers.setUsername(platUserDto.getJobNum());
        sysUsers.setTelphone(platUserDto.getPhone());
        sysUsers.setPassword(PasswdUtils.encodePassword("123456"));
        sysUsers.setPlatId(platUserDto.getUserId());
        sysUsers.setIsPlat(1);
        sysUsers.setPhotoUrl(platUserDto.getPhotoUrl());
        return sysUsers;
 
    }
 
    public static void main(String[] args) {
        //System.out.println(StaffNoUtils.create(2,5));
        System.out.println(PasswdUtils.encodePassword("123456"));
    }
}