Index: forgon-core/src/main/java/com/forgon/util/StringUtil.java =================================================================== diff -u -r26629 -r33361 --- forgon-core/src/main/java/com/forgon/util/StringUtil.java (.../StringUtil.java) (revision 26629) +++ forgon-core/src/main/java/com/forgon/util/StringUtil.java (.../StringUtil.java) (revision 33361) @@ -16,6 +16,7 @@ import java.util.regex.Pattern; import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.CharUtils; import com.forgon.tools.string.StringTools; import com.jfinal.kit.StrKit; @@ -696,4 +697,34 @@ } return false; } + + /** + * 截取一定长度的字符串(ascii字符长度算1,否则长度算2),末尾填充省略号 + * @param text 实际的全部内容 + * @param sublLength 要截取的长度 + * @return + */ + public static String subStringByAsciiLength(String text,int sublLength){ + if(StringUtils.isNotBlank(text)){ + StringBuffer buff = new StringBuffer(); + int length = 0; + char[] textCharArr = text.toCharArray(); + for (int i = 0; i < textCharArr.length; i++) { + char c = textCharArr[i]; + if(CharUtils.isAscii(c)){ + length += 1; + }else{ + length += 2; + } + if(length > sublLength){ + break; + } + buff.append(c); + } + buff.append("......"); + return buff.toString(); + } + return text; + } + } Index: ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/service/ServiceManagerImpl.java =================================================================== diff -u -r33293 -r33361 --- ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/service/ServiceManagerImpl.java (.../ServiceManagerImpl.java) (revision 33293) +++ ssts-webservice/src/main/java/com/forgon/disinfectsystem/webservice/service/ServiceManagerImpl.java (.../ServiceManagerImpl.java) (revision 33361) @@ -222,6 +222,7 @@ import com.forgon.tools.util.ForgonDateUtils; import com.forgon.tools.util.SqlUtils; import com.forgon.treenode.model.THTreeNode; +import com.forgon.util.StringUtil; import com.google.gson.ExclusionStrategy; import com.google.gson.FieldAttributes; import com.google.gson.Gson; @@ -861,7 +862,8 @@ } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - if(invoicePlans != null){ + + if(CollectionUtils.isNotEmpty(invoicePlans)){ for (InvoicePlan plan : invoicePlans) { Integer includeRecyclingItems = plan.getIncludeRecyclingItems(); if (includeRecyclingItems != null @@ -881,6 +883,13 @@ appTime = sdf.format(plan.getSubmitTime()); } catch (Exception e) {} obj.put("appTime", appTime); + obj.put("operationRoom", plan.getOperationRoom()); + //pda端显示40个汉字占80长度ascii字符减掉6个点的省略号,所以为74 + obj.put("remark", StringUtil.subStringByAsciiLength(plan.getRemark(),76)); + //如果该申请单为使用记录转换过来,则标识为来自于使用记录的转换 + if(plan instanceof RecyclingApplication && ((RecyclingApplication)plan).getUseRecord() != null){ + obj.put("fromUseRecord", true); + } dataArray.add(obj); } }