|
@@ -20,7 +20,9 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.ParseException;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* AmsContractTransportPrice RESTful接口:
|
|
@@ -193,7 +195,7 @@ public class AmsContractTruckPriceController extends BaseRESTfulController {
|
|
|
Integer apiId,
|
|
|
Integer pageNum,
|
|
|
Integer pageSize,
|
|
|
- String con,String userId){
|
|
|
+ String con,String userId) throws ParseException {
|
|
|
if (con != null && !con.equals("undefined")) {
|
|
|
mapValue.put("con","%" + con + "%");
|
|
|
}
|
|
@@ -202,47 +204,52 @@ public class AmsContractTruckPriceController extends BaseRESTfulController {
|
|
|
String carrierName1 = amsContractTruckPriceService.getCarrierNameForDetail(userId);
|
|
|
mapValue.put("carrierName1","%" + carrierName1 + "%");
|
|
|
}
|
|
|
- //不分页筛选数据
|
|
|
- PageHelper.startPage(pageNum,pageSize);
|
|
|
- //分页数据
|
|
|
+ //1.先查询出收货地址的所有收货ID
|
|
|
+ List<Map<String, Object>> receiveAddress = amsContractTruckPriceService.getReceiveAddressId(mapValue);
|
|
|
+ //2.查询出该收货所有的单价信息
|
|
|
List<Map<String, Object>> saleOrderList = amsContractTruckPriceService.getAmsContractTransportPriceForDetail(mapValue);
|
|
|
- List<Map<String, Object>> columnDataList = columnDataFeign.getColumnData(apiId);
|
|
|
- int i=0;
|
|
|
- for (Map<String, Object> columnData : columnDataList) {
|
|
|
- //每个表头字段的过滤条件
|
|
|
- columnData.put("filters", setListMap(saleOrderList, columnData.get("prop").toString()));
|
|
|
- if (i==0){
|
|
|
- columnData.put("min-width","78px");
|
|
|
- }else if (i==2){
|
|
|
- columnData.put("min-width","94px");
|
|
|
+ //3.遍历查询出最近的单价信息
|
|
|
+ List<Map<String,Object>> salePriceList=new LinkedList<>();
|
|
|
+ //格式化
|
|
|
+ SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ //获取数据的订单时间
|
|
|
+ Date orderTime = simpleDateFormat.parse((String) mapValue.get("orderTime"));
|
|
|
+ //最近的留下
|
|
|
+ for (Map<String, Object> address : receiveAddress) {
|
|
|
+ String address1 = (String) address.get("address");
|
|
|
+ //BigDecimal placeId = bigDecimal;
|
|
|
+ Map<String,Object> map1=new HashMap<>();
|
|
|
+ int flag=0;
|
|
|
+ for (Map<String, Object> stringObjectMap : saleOrderList) {
|
|
|
+ String address2 = (String) stringObjectMap.get("address");
|
|
|
+ //单价的执行日期
|
|
|
+ Date priceDate = (Date) stringObjectMap.get("priceDate");
|
|
|
+ String format = simpleDateFormat.format(priceDate);
|
|
|
+ Date parse = simpleDateFormat.parse(format);
|
|
|
+ //Date parse1 = simpleDateFormat.parse("2022-12-10")
|
|
|
+ if (parse.before(orderTime)||parse.equals(orderTime)){
|
|
|
+ if (address2.equals(address1)){
|
|
|
+ flag=1;
|
|
|
+ if (map1.size()==0){
|
|
|
+ map1.putAll(stringObjectMap);
|
|
|
+ }else{
|
|
|
+ //比较日期(如果日期在存入的日期之后,则存入该日期)
|
|
|
+ Date priceDate1 = (Date) map1.get("priceDate");
|
|
|
+ String format1 = simpleDateFormat.format(priceDate1);
|
|
|
+ Date parse1 = simpleDateFormat.parse(format1);
|
|
|
+ if (parse.after(parse1)){
|
|
|
+ map1.clear();
|
|
|
+ map1.putAll(stringObjectMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag==1){
|
|
|
+ salePriceList.add(map1);
|
|
|
}
|
|
|
- i++;
|
|
|
}
|
|
|
- PageListAdd pageList = new PageListAdd(saleOrderList);
|
|
|
- pageList.setColumnData(columnDataList);
|
|
|
- //PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null,saleOrderList);
|
|
|
- return success(pageList);
|
|
|
-// if(con !=null){
|
|
|
-// mapValue.put("con",con);
|
|
|
-// }
|
|
|
-// PageHelper.startPage(pageNum,pageSize);
|
|
|
-// if (userId!=null){
|
|
|
-// //查询承运商ID
|
|
|
-// String carrierName = amsContractTruckPriceService.getCarrierNameForDetail(userId);
|
|
|
-// mapValue.put("carrierName1",carrierName);
|
|
|
-// }
|
|
|
-// List<Map<String, Object>> amsContractTransportPrice1 = amsContractTruckPriceService.getAmsContractTransportPriceForDetail(mapValue);
|
|
|
-// List<Map<String, Object>> columnDataList = columnDataFeign.getColumnData(apiId);
|
|
|
-// for (Map<String, Object> columnData : columnDataList) {
|
|
|
-// //每个表头字段的过滤条件
|
|
|
-// if(columnData.get("isFilter") == null || DataChange.dataToBigDecimal(columnData.get("isFilter")).intValue() == 1) {
|
|
|
-// columnData.put("filters", setListMap(amsContractTransportPrice1, columnData.get("prop").toString()));
|
|
|
-// }
|
|
|
-// }
|
|
|
-// PageListAdd pageList = new PageListAdd(amsContractTransportPrice1);
|
|
|
-// pageList.setColumnData(columnDataList);
|
|
|
-// //PageListAdd pageList = columnDataUtil.tableColumnData(apiId, null,amsContractTransportPrice1);
|
|
|
-// return success(pageList);
|
|
|
+ return success(salePriceList);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value="查询内转汽运单价信息")
|