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;
|
}
|
|
}
|