package com.gkhy.safePlatform.specialWork.util; import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.DepInfoRPCRespDTO; import com.gkhy.safePlatform.commons.utils.StringUtils; import com.gkhy.safePlatform.specialWork.entity.WorkApplyOperatorInfo; import com.gkhy.safePlatform.specialWork.enums.WorkTypeEnum; 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 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 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 shiftList(String str){ if(StringUtils.isNotBlank(str)){ List 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 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; } }