Commit c6dfb54a authored by 竹天卫's avatar 竹天卫

报告导出优化

parent 0f6d039f
...@@ -129,21 +129,26 @@ public class ReportController { ...@@ -129,21 +129,26 @@ public class ReportController {
private String getFirstSet(Set<String> set) { private String getFirstSet(Set<String> set) {
Iterator<String> iterator = set.iterator(); if(set != null && set.size()>0){
if (iterator.hasNext()) { Iterator<String> iterator = set.iterator();
return iterator.next(); if (iterator.hasNext()) {
return iterator.next();
}
} }
return ""; return "";
} }
private static Set<String> moveFirst(Set<String> set) { private static Set<String> moveFirst(Set<String> set) {
Set<String> newSet = new HashSet<>(set.size()); if(set != null && set.size()>0){
Iterator<String> iterator = set.iterator(); Set<String> newSet = new HashSet<>(set.size());
if (iterator.hasNext()) { Iterator<String> iterator = set.iterator();
String next = iterator.next(); if (iterator.hasNext()) {
newSet.addAll(set); String next = iterator.next();
newSet.remove(next); newSet.addAll(set);
return newSet; newSet.remove(next);
return newSet;
}
} }
return null; return null;
} }
......
...@@ -134,7 +134,7 @@ public class Sample implements Serializable { ...@@ -134,7 +134,7 @@ public class Sample implements Serializable {
*/ */
public static String weight2Kg(String weight,Integer weightType){ public static String weight2Kg(String weight,Integer weightType){
String result = ""; String result = "";
if(StringUtils.isNotBlank(weight)){ if(StringUtils.isNotBlank(weight) && weightType != null ){
if(weightType == 1){ if(weightType == 1){
result = new BigDecimal(weight).divide(new BigDecimal(1000000000)).toString(); result = new BigDecimal(weight).divide(new BigDecimal(1000000000)).toString();
}else if(weightType == 2){ }else if(weightType == 2){
......
...@@ -4961,33 +4961,38 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -4961,33 +4961,38 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
List<Method> methods = JSON.parseArray(redisUtil.getString(methodKey) + "", Method.class); List<Method> methods = JSON.parseArray(redisUtil.getString(methodKey) + "", Method.class);
list.forEach(arg -> { list.forEach(arg -> {
String teamIds = arg.getTeamIds(); String teamIds = arg.getTeamIds();
String[] teamSplit = teamIds.split("、"); if(StringUtils.isNoneBlank(teamIds)){
for (String idStr : teamSplit) { String[] teamSplit = teamIds.split("、");
int id = Integer.parseInt(idStr); for (String idStr : teamSplit) {
teams.forEach(opt -> { int id = Integer.parseInt(idStr);
if (opt.getId() == id && 1 == opt.getQualifications()) { teams.forEach(opt -> {
String teamName = replaceSub(opt.getName()); if (opt.getId() == id && 1 == opt.getQualifications()) {
if (StrUtil.isBlank(arg.getTeamName())) { String teamName = replaceSub(opt.getName());
arg.setTeamName(teamName); if (StrUtil.isBlank(arg.getTeamName())) {
} else { arg.setTeamName(teamName);
arg.setTeamName(arg.getTeamName() + "、" + teamName); } else {
arg.setTeamName(arg.getTeamName() + "、" + teamName);
}
} }
} });
}); }
} }
String methodNumbers = arg.getMethodNumbers(); String methodNumbers = arg.getMethodNumbers();
String[] methodSplit = methodNumbers.split("、"); if(StringUtils.isNoneBlank(methodNumbers)){
for (String idStr : methodSplit) { String[] methodSplit = methodNumbers.split("、");
String id = Integer.parseInt(idStr) + ""; for (String idStr : methodSplit) {
methods.forEach(opt -> { String id = Integer.parseInt(idStr) + "";
if (id.equals(opt.getNumber())) { methods.forEach(opt -> {
if (StrUtil.isBlank(arg.getMethodName())) { if (id.equals(opt.getNumber())) {
arg.setMethodName(opt.getName() + " " + opt.getStandard()); if (StrUtil.isBlank(arg.getMethodName())) {
} else { arg.setMethodName(opt.getName() + " " + opt.getStandard());
arg.setMethodName(arg.getMethodName() + "、" + opt.getName() + " " + opt.getStandard()); } else {
arg.setMethodName(arg.getMethodName() + "、" + opt.getName() + " " + opt.getStandard());
}
} }
} });
}); }
} }
}); });
...@@ -5036,6 +5041,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -5036,6 +5041,7 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
//将样品重量换算成kg //将样品重量换算成kg
if(newList != null){ if(newList != null){
newList.stream().forEach(arg ->{ newList.stream().forEach(arg ->{
arg.setWeight(Sample.weight2Kg(arg.getWeight(), arg.getWeightType())); arg.setWeight(Sample.weight2Kg(arg.getWeight(), arg.getWeightType()));
}); });
} }
...@@ -5655,7 +5661,9 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -5655,7 +5661,9 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
rts.setTeamNames(new HashSet<>(source.size())); rts.setTeamNames(new HashSet<>(source.size()));
Set<Integer> equipmentIds = new HashSet<>(source.size()); Set<Integer> equipmentIds = new HashSet<>(source.size());
source.forEach(arg -> { source.forEach(arg -> {
equipmentIds.add(arg.getEquipmentId()); if(arg.getEquipmentId() != null){
equipmentIds.add(arg.getEquipmentId());
}
//获取使用的设备id view //获取使用的设备id view
//关联检测项目 //关联检测项目
if (StrUtil.isNotBlank(arg.getTeamName())) { if (StrUtil.isNotBlank(arg.getTeamName())) {
...@@ -5680,8 +5688,11 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl ...@@ -5680,8 +5688,11 @@ public class EntrustServiceImpl extends ServiceImpl<EntrustMapper, Entrust> impl
rts.setSampleNum(rts.getSampleNames().size()); rts.setSampleNum(rts.getSampleNames().size());
//关联仪器名字 去重 //关联仪器名字 去重
List<String> equipmentNames = equipmentUseMapper.getEquipmentNamesByEquipmentIds(equipmentIds); if(equipmentIds != null && equipmentIds.size()>0){
equipmentNames.forEach(arg -> rts.getEquipmentNames().add(arg)); List<String> equipmentNames = equipmentUseMapper.getEquipmentNamesByEquipmentIds(equipmentIds);
equipmentNames.forEach(arg -> rts.getEquipmentNames().add(arg));
}
//关联送样单位名字 //关联送样单位名字
String clientKey = "CACHE:CLIENT"; String clientKey = "CACHE:CLIENT";
......
...@@ -1807,15 +1807,14 @@ ...@@ -1807,15 +1807,14 @@
<Borders> <Borders>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders> </Borders>
<Font ss:FontName="楷体" x:CharSet="134" x:Family="Modern" ss:Size="14"/> <Font ss:FontName="Times New Roman" x:CharSet="134" x:Family="Modern" ss:Size="12" ss:Color="#FF0000"/>
</Style> </Style>
<Style ss:ID="s179"> <Style ss:ID="s179">
<Alignment ss:Vertical="Bottom"/> <Alignment ss:Vertical="Bottom"/>
<Borders> <Borders>
<Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/> <Border ss:Position="Left" ss:LineStyle="Continuous" ss:Weight="1"/>
</Borders> </Borders>
<Font ss:FontName="Times New Roman" x:Family="Roman" ss:Size="12" <Font ss:FontName="Times New Roman" x:CharSet="134" x:Family="Modern" ss:Size="12" ss:Color="#FF0000"/>
ss:Color="#FF0000"/>
</Style> </Style>
<Style ss:ID="s180"> <Style ss:ID="s180">
<Alignment ss:Vertical="Bottom"/> <Alignment ss:Vertical="Bottom"/>
...@@ -3963,10 +3962,11 @@ ...@@ -3963,10 +3962,11 @@
<Row ss:AutoFitHeight="0" ss:Height="20"> <Row ss:AutoFitHeight="0" ss:Height="20">
<Cell ss:MergeDown="14" ss:StyleID="s166"><Data ss:Type="String">检测依据</Data><NamedCell <Cell ss:MergeDown="14" ss:StyleID="s166"><Data ss:Type="String">检测依据</Data><NamedCell
ss:Name="_FilterDatabase"/></Cell> ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s167"><ss:Data ss:Type="String" <Cell ss:StyleID="s167">
xmlns="http://www.w3.org/TR/REC-html40"> <ss:Data ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40">
<Font html:Face="楷体" x:Family="Modern">${firstMethodName}</Font><Font> </Font></ss:Data><NamedCell <Font html:Face="楷体" x:Family="Modern">${firstMethodName}</Font>
ss:Name="_FilterDatabase"/></Cell> <Font> </Font>
</ss:Data><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:Index="4" ss:StyleID="s168"><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell ss:Index="4" ss:StyleID="s168"><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:Index="9" ss:StyleID="s122"/> <Cell ss:Index="9" ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/> <Cell ss:StyleID="s122"/>
...@@ -4052,9 +4052,16 @@ ...@@ -4052,9 +4052,16 @@
</Row> </Row>
</#if> </#if>
</#if> </#if>
<#--如果检测依据信息为空--> <#--如果检测依据信息为空-->
<#if ! methodNames??> <#if ! methodNames??>
<#list 1..(2-12) as i> <Row ss:AutoFitHeight="0" ss:Height="20">
<Cell ss:Index="2" ss:MergeAcross="2" ss:StyleID="m2194692801716"><Data
ss:Type="String">以下空白</Data><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:Index="9" ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/>
</Row>
<#list 1..(2-14) as i>
<Row ss:AutoFitHeight="0" ss:Height="17.25"> <Row ss:AutoFitHeight="0" ss:Height="17.25">
<Cell ss:Index="2" ss:StyleID="s167"><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell ss:Index="2" ss:StyleID="s167"><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s173"><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell ss:StyleID="s173"><NamedCell ss:Name="_FilterDatabase"/></Cell>
...@@ -4078,19 +4085,16 @@ ...@@ -4078,19 +4085,16 @@
</#if> </#if>
<#-- 仪器设备 9 --> <#-- 仪器设备 9 -->
<#--插入第一个设备--> <#--插入第一个设备-->
<Row ss:AutoFitHeight="0" ss:Height="18" ss:StyleID="s173"> <Row ss:AutoFitHeight="0" ss:Height="18" >
<Cell ss:MergeDown="8" ss:StyleID="s187"><Data ss:Type="String">主要仪器设备(编号)</Data><NamedCell <Cell ss:MergeDown="8" ss:StyleID="s187"><Data ss:Type="String">主要仪器设备(编号)</Data><NamedCell
ss:Name="_FilterDatabase"/></Cell> ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s178"> <Cell ss:StyleID="s167">
<ss:Data ss:Type="String" <ss:Data ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40">
xmlns="http://www.w3.org/TR/REC-html40"> <Font html:Size="12">${firstEquipment}</Font><Font <Font html:Face="楷体" x:Family="Modern">${firstEquipment}</Font>
html:Face="Times New Roman" x:Family="Roman" html:Size="12"> </Font></ss:Data> <Font > </Font>
<NamedCell </ss:Data> <NamedCell ss:Name="_FilterDatabase"/></Cell>
ss:Name="_FilterDatabase"/></Cell> <Cell ss:Index="4" ss:StyleID="s168"><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:Index="4" ss:StyleID="s562"><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell ss:Index="9" ss:StyleID="s122"/>
<Cell ss:Index="6" ss:StyleID="s185"><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:Index="8" ss:StyleID="s122"><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/> <Cell ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/> <Cell ss:StyleID="s122"/>
</Row> </Row>
...@@ -4098,11 +4102,11 @@ ...@@ -4098,11 +4102,11 @@
<#--如果设备信息不为空--> <#--如果设备信息不为空-->
<#if equipmentNames??> <#if equipmentNames??>
<#list equipmentNames as item> <#list equipmentNames as item>
<Row ss:AutoFitHeight="0" ss:Height="18"> <Row ss:AutoFitHeight="0" ss:Height="18" ss:StyleID="s173">
<Cell ss:Index="2" ss:StyleID="s179"> <Cell ss:Index="2" ss:StyleID="s167">
<ss:Data ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40"> <ss:Data ss:Type="String" xmlns="http://www.w3.org/TR/REC-html40">
<Font html:Size="12">${item}</Font> <Font html:Size="12">${item}</Font>
<Font html:Face="Times New Roman" x:Family="Roman" html:Size="12"> </Font> <Font html:Face="Times New Roman" x:Family="Roman" html:Size="12"> </Font>
</ss:Data><NamedCell ss:Name="_FilterDatabase"/> </ss:Data><NamedCell ss:Name="_FilterDatabase"/>
</Cell> </Cell>
<Cell ss:Index="4" ss:StyleID="s563"><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell ss:Index="4" ss:StyleID="s563"><NamedCell ss:Name="_FilterDatabase"/></Cell>
...@@ -4142,15 +4146,33 @@ ...@@ -4142,15 +4146,33 @@
</#if> </#if>
<#--如果设备为空--> <#--如果设备为空-->
<#if ! equipmentNames??> <#if ! equipmentNames??>
<Row ss:AutoFitHeight="0" ss:Height="20">
<Cell ss:Index="2" ss:MergeAcross="2" ss:StyleID="m2194692801716"><Data
ss:Type="String">以下空白</Data><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:Index="9" ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/>
</Row>
<#list 1..(2-8) as i> <#list 1..(2-8) as i>
<Row ss:AutoFitHeight="0" ss:Height="18"> <Row ss:AutoFitHeight="0" ss:Height="17.25">
<Cell ss:Index="2" ss:StyleID="s179"><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell ss:Index="2" ss:StyleID="s167"><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:Index="4" ss:StyleID="s563"><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell ss:StyleID="s173"><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:Index="8" ss:StyleID="s122"><NamedCell ss:Name="_FilterDatabase"/></Cell> <Cell ss:StyleID="s174"><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s122"/> <Cell ss:StyleID="s122"><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s122"/> <Cell ss:StyleID="s122"><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:StyleID="s122"/> <Cell ss:StyleID="s122"><NamedCell ss:Name="_FilterDatabase"/></Cell>
</Row> <Cell ss:StyleID="s122"><NamedCell ss:Name="_FilterDatabase"/></Cell>
<Cell ss:Index="11" ss:StyleID="Default"/>
<Cell ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/>
<Cell ss:StyleID="s122"/>
</Row>
</#list> </#list>
</#if> </#if>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment