Merge remote-tracking branch 'origin/master'

master
yangwl 4 years ago
commit c8acd6d009

@ -2,6 +2,7 @@ package com.ruoyi.web.controller.nanjing;
import com.alibaba.fastjson.JSONArray;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.nanjing.domain.Demo;
import com.ruoyi.nanjing.domain.ReportData;
import com.ruoyi.nanjing.domain.TBdProductinfo;
import com.ruoyi.nanjing.service.ITBdProducttypeService;
@ -43,31 +44,57 @@ public class ReportDataController extends BaseController {
List<ReportData> reportDataList = producttypeService.selectReport(map);
List<String> paraName = new ArrayList<>();
List<String> barcodelist = new ArrayList<>();
List<String> barcodes = new ArrayList<>();
List<String> stations = new ArrayList<>();
//取出参数名
reportDataList.forEach(x->barcodelist.add(x.getBarcode()));
reportDataList.forEach(x->barcodes.add(x.getBarcode()));
reportDataList.forEach(x->paraName.add(x.getParameaning()));
reportDataList.forEach(x->stations.add(x.getStationName()));
//去重
List<String> barcodeList = barcodelist.stream().distinct().collect(Collectors.toList());
//条码List
List<String> barcodeList = barcodes.stream().distinct().collect(Collectors.toList());
//参数List
List<String> paraNameList = paraName.stream().distinct().collect(Collectors.toList());
//工位名集合
List<String> stationList = stations.stream().distinct().collect(Collectors.toList());
//定义结果集合
List<Map<String,Object>> list = new ArrayList<>();
//定义结果集map
Map<String,Object> map1 = new HashMap<>();
for(String item:barcodeList){
map1.put("barcode",item);
for (String param:paraNameList) {
for (String station:stationList) {
for(String param:paraNameList){
for (ReportData rpd:reportDataList) {
if (rpd.getBarcode().equals(item)&&rpd.getParameaning().equals(param)){
// if (rpd.getBarcode().equals(item)&&rpd.getStationName().equals(station)){
// map1.put(station,rpd.getStationName());
// }
if (rpd.getBarcode().equals(item)&&rpd.getStationName().equals(station)&&rpd.getParameaning().equals(param)){
if(rpd.getValue()==null){
rpd.setValue("-");
}
map1.put(station,param);
map1.put(param,rpd.getValue());
// map1.put(param+"value",rpd.getValue());
break;
}
}
}
}
// for (String param:paraNameList) {
// for (ReportData rpd:reportDataList) {
// if (rpd.getBarcode().equals(item)&&rpd.getParameaning().equals(param)){
// if(rpd.getValue()==null){
// rpd.setValue("-");
// }
// map1.put(param,rpd.getValue());
//// map1.put(param+"value",rpd.getValue());
// break;
// }
// }
// }
//排序的作用
TreeMap<String,Object> treeMap = new TreeMap<>(map1);
list.add(treeMap);

@ -51,14 +51,14 @@
processData: false,
contentType: false,
success: function (json) {
// var coulmnsData = [];
var coulmnsData = [];
var columnsArray = [];
columnsArray.push({field : "barcode",title : "产品条码",colspan: 1,rowspan: 1});
// var columns = [];
columnsArray.push({field : "barcode",title : "产品条码",colspan: 1,rowspan: 2});
var columns = [];
if(json.length>0){
// console.log(Object.keys(json[0]).length);
for (var i = 0; i < (Object.keys(json[0])).length; i++) {//Object.keys(obj) 获取key名称
var property = (Object.keys(json[0]))[i];//id username
var property = (Object.keys(json[0]))[i];
if(property!='barcode'){
columnsArray.push({
"title": property,
@ -66,13 +66,16 @@
switchable: true,
align:"center",
}
columns.push({
"title": property,
"field": property,
})
);
}
}
}
// coulmnsData.push(columnsArray);
// coulmnsData.push(columns);
coulmnsData.push(columnsArray);
coulmnsData.push(columns);
// console.log(columnsArray);
$('#bootstrap-table').bootstrapTable('destroy').bootstrapTable({
id: "bootstrap-table",

@ -13,6 +13,15 @@ public class ReportData extends BaseEntity {
private long id;
private Date beginTime;
private Date endTime;
private String stationName;
public String getStationName() {
return stationName;
}
public void setStationName(String stationName) {
this.stationName = stationName;
}
public String getBarcode() {
return barcode;

@ -57,6 +57,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="barcode" column="Barcode"/>
<result property="parameaning" column="parameaning"/>
<result property="value" column="value"/>
<result property="beginTime" column="begintime"/>
<result property="stationName" column="stationname"/>
</resultMap>
<sql id="selectTBdProducttypeVo">
select ID, ProductTypeID, ProductTypeName from T_BD_ProductType
@ -151,7 +153,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectReport" parameterType="map" statementType="CALLABLE" resultMap="repo">
{
call begin_date4
call begin_date5
(
#{begin,mode=IN,jdbcType=DATE},
#{end,mode=IN,jdbcType=DATE},

Loading…
Cancel
Save