|
|
@ -1,5 +1,6 @@
|
|
|
|
package com.ruoyi.web.controller.nanjing;
|
|
|
|
package com.ruoyi.web.controller.nanjing;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.nanjing.domain.ReportData;
|
|
|
|
import com.ruoyi.nanjing.domain.ReportData;
|
|
|
|
import com.ruoyi.nanjing.domain.TBdProductinfo;
|
|
|
|
import com.ruoyi.nanjing.domain.TBdProductinfo;
|
|
|
@ -13,9 +14,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
@Controller
|
|
|
|
@RequestMapping("/nanjing/reportData")
|
|
|
|
@RequestMapping("/nanjing/reportData")
|
|
|
@ -28,19 +28,49 @@ public class ReportDataController extends BaseController {
|
|
|
|
@GetMapping()
|
|
|
|
@GetMapping()
|
|
|
|
public String reportData(ModelMap map)
|
|
|
|
public String reportData(ModelMap map)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// return prefix + "/Report";
|
|
|
|
return prefix + "/Report";
|
|
|
|
return "redirect:"+"http://127.0.0.1:18080/RDP-SERVER/rdppage/main/d354a3beb6dae7938155b3f9a962e479";
|
|
|
|
// return "redirect:"+"http://127.0.0.1:18080/RDP-SERVER/rdppage/main/d354a3beb6dae7938155b3f9a962e479";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/report")
|
|
|
|
@PostMapping("/report")
|
|
|
|
@ResponseBody
|
|
|
|
@ResponseBody
|
|
|
|
public List<ReportData> reportData(String begin,String end,String barcode)
|
|
|
|
public String reportData(String begin,String end,String barcode)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Map map = new HashMap<String,Object>();
|
|
|
|
Map map = new HashMap<String,Object>();
|
|
|
|
map.put("begin",begin);
|
|
|
|
map.put("begin",begin);
|
|
|
|
map.put("end",end);
|
|
|
|
map.put("end",end);
|
|
|
|
map.put("barcode",barcode);
|
|
|
|
map.put("barcode",barcode);
|
|
|
|
List<ReportData> reportDataList = producttypeService.selectReport(map);
|
|
|
|
List<ReportData> reportDataList = producttypeService.selectReport(map);
|
|
|
|
return reportDataList;
|
|
|
|
|
|
|
|
|
|
|
|
List<String> paraName = new ArrayList<>();
|
|
|
|
|
|
|
|
List<String> barcodelist = new ArrayList<>();
|
|
|
|
|
|
|
|
//取出参数名
|
|
|
|
|
|
|
|
reportDataList.forEach(x->barcodelist.add(x.getBarcode()));
|
|
|
|
|
|
|
|
reportDataList.forEach(x->paraName.add(x.getParameaning()));
|
|
|
|
|
|
|
|
//去重
|
|
|
|
|
|
|
|
List<String> barcodeList = barcodelist.stream().distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> paraNameList = paraName.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 (ReportData rpd:reportDataList) {
|
|
|
|
|
|
|
|
if (rpd.getBarcode().equals(item)&&rpd.getParameaning().equals(param)){
|
|
|
|
|
|
|
|
map1.put(param,rpd.getParameaning());
|
|
|
|
|
|
|
|
map1.put(param+"value",rpd.getValue());
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//排序的作用
|
|
|
|
|
|
|
|
TreeMap<String,Object> treeMap = new TreeMap<>(map1);
|
|
|
|
|
|
|
|
list.add(treeMap);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String info = JSONArray.toJSONString(list);
|
|
|
|
|
|
|
|
// System.out.println(info);
|
|
|
|
|
|
|
|
return info;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|