郑永安
2023-09-19 69185134fcfaf913ea45f1255677225a2cc311a4
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package com.gk.hotwork.specialWork.util;
 
 
import com.gk.hotwork.Domain.dto.DepInfoRPCRespDTO;
import com.gk.hotwork.specialWork.entity.WorkApplyOperatorInfo;
import com.gk.hotwork.specialWork.enums.WorkTypeEnum;
import org.apache.commons.lang3.StringUtils;
 
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
 
public class WorkPrintShiftUtil {
    /**
     * 时间转换
     */
    public static String shiftTime(LocalDateTime dateTime){
        if(null != dateTime){
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日HH时mm分");
            String time = formatter.format(dateTime);
            return time;
        }
      return null;
 
    }
    /**
     * 特殊作业名称转换
     */
    public static String shiftOtherSpecialWork(String otherSpecialWorkIds){
        if(StringUtils.isNotBlank(otherSpecialWorkIds)){
            String[] strSplit = otherSpecialWorkIds.split(",");
            StringBuffer stringBuffer = new StringBuffer();
            for (String str : strSplit) {
                stringBuffer.append(WorkTypeEnum.parse(Byte.parseByte(str)).getName()).append(",");
            }
            stringBuffer.deleteCharAt(stringBuffer.toString().length()-1);
            return stringBuffer.toString();
        }
       return null;
    }
    /**
     * 作业人转换
     */
    public static String shiftOperators(List<WorkApplyOperatorInfo> list){
        if(null != list && list.size()>0){
            StringBuffer stringBuffer = new StringBuffer();
            for (WorkApplyOperatorInfo operatorInfo : list) {
                stringBuffer.append(operatorInfo.getOperatorUname()).append(",");
            }
            String substring = stringBuffer.toString().substring(0, stringBuffer.length() - 1);
            return substring;
        }
       return null;
    }
 
    /**
     * 字符串转换list集合
     * @param str
     * @return
     */
    public static List<Long> shiftList(String str){
        if(StringUtils.isNotBlank(str)){
            List<Long> list = new ArrayList<>();
            String[] arr = str.split(",");
            for (int i = 0; i < arr.length; i++) {
                list.add(Long.valueOf(arr[i]));
            }
            return list;
        }
       return null;
    }
    /**
     * 相关部门转换
     */
    public static String shiftInvolvedDepName(List<DepInfoRPCRespDTO> deptInfoList){
        if(null != deptInfoList && deptInfoList.size() > 0){
            StringBuffer stringBuffer = new StringBuffer();
            for (DepInfoRPCRespDTO deptInfo : deptInfoList) {
                stringBuffer.append(deptInfo.getDepName()).append(",");
            }
            String substring = stringBuffer.toString().substring(0, stringBuffer.length() - 1);
            return substring;
        }
        return null;
    }
 
}