|
|
@@ -1,5 +1,7 @@
|
|
|
package com.steerinfo.dil.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.steerinfo.dil.feign.ESFeign;
|
|
|
import com.steerinfo.dil.service.impl.BmsshipStatementServiceImpl;
|
|
|
import com.steerinfo.dil.service.impl.BmstruckFormulaServiceImpl;
|
|
|
import com.steerinfo.dil.util.BaseRESTfulController;
|
|
|
@@ -38,9 +40,12 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
BmstruckFormulaServiceImpl bmstruckFormulaService;
|
|
|
@Autowired
|
|
|
ColumnDataUtil columnDataUtil;
|
|
|
+ @Autowired
|
|
|
+ ESFeign esFeign;
|
|
|
|
|
|
/**
|
|
|
* 展示水运费和水分质检费账单信息
|
|
|
+ *
|
|
|
* @param mapValue
|
|
|
* @param pageNum
|
|
|
* @param pageSize
|
|
|
@@ -54,20 +59,50 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
@ApiImplicitParam(name = "apiId", value = "101", required = false, dataType = "BigDecimal")
|
|
|
})
|
|
|
@PostMapping("/getStatementList")
|
|
|
- public RESTfulResult getStatementList(@RequestBody(required = false) Map<String,Object> mapValue,
|
|
|
+ public RESTfulResult getStatementList(@RequestBody(required = false) Map<String, Object> mapValue,
|
|
|
Integer pageNum,
|
|
|
Integer pageSize,
|
|
|
- Integer apiId) {
|
|
|
- List<Map<String, Object>> list = bmsshipStatementService.getStatementList(mapValue);
|
|
|
+ Integer apiId,
|
|
|
+ String con) {
|
|
|
+ if (con != null) {
|
|
|
+ if (!"undefined".equals(con)) {
|
|
|
+ //设置要查询的索引名称
|
|
|
+ String index = "get_statement_list";
|
|
|
+ //获取查询结果
|
|
|
+ return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //初始化过滤
|
|
|
+ List<Map<String, Object>> statementList = null;
|
|
|
+ //如果有条件查询则跳过初始化,和创建索引
|
|
|
+ if (mapValue.size() == 0) {
|
|
|
+ //将查询结果存入索引中
|
|
|
+ statementList = bmsshipStatementService.getStatementList(mapValue);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ //添加索引
|
|
|
+ map.put("index", "get_statement_list");
|
|
|
+ //添加id
|
|
|
+ map.put("indexId", "statementId");
|
|
|
+ statementList.add(map);
|
|
|
+ //新建索引
|
|
|
+ String s = JSON.toJSONString(statementList);
|
|
|
+ esFeign.insertIndex(statementList);
|
|
|
+ //删除
|
|
|
+ statementList.remove(statementList.size() - 1);
|
|
|
+ }
|
|
|
+ if (statementList == null) {
|
|
|
+ statementList = bmsshipStatementService.getStatementList(mapValue);
|
|
|
+ }
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
//分页查询数据
|
|
|
List<Map<String, Object>> columnList = bmsshipStatementService.getStatementList(mapValue);
|
|
|
- PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
|
|
|
+ PageListAdd data = columnDataUtil.tableColumnData(apiId, statementList, columnList);
|
|
|
return success(data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 展示途损费账单信息
|
|
|
+ *
|
|
|
* @param mapValue
|
|
|
* @param pageNum
|
|
|
* @param pageSize
|
|
|
@@ -81,20 +116,50 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
@ApiImplicitParam(name = "apiId", value = "101", required = false, dataType = "BigDecimal")
|
|
|
})
|
|
|
@PostMapping("/getLossStatementList")
|
|
|
- public RESTfulResult getLossStatementList(@RequestBody(required = false) Map<String,Object> mapValue,
|
|
|
- Integer pageNum,
|
|
|
- Integer pageSize,
|
|
|
- Integer apiId) {
|
|
|
- List<Map<String, Object>> list = bmsshipStatementService.getLossStatementList(mapValue);
|
|
|
+ public RESTfulResult getLossStatementList(@RequestBody(required = false) Map<String, Object> mapValue,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize,
|
|
|
+ Integer apiId,
|
|
|
+ String con) {
|
|
|
+ if (con != null) {
|
|
|
+ if (!"undefined".equals(con)) {
|
|
|
+ //设置要查询的索引名称
|
|
|
+ String index = "get_loss_statement_list";
|
|
|
+ //获取查询结果
|
|
|
+ return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //初始化过滤
|
|
|
+ List<Map<String, Object>> statementList = null;
|
|
|
+ //如果有条件查询则跳过初始化,和创建索引
|
|
|
+ if (mapValue.size() == 0) {
|
|
|
+ //将查询结果存入索引中
|
|
|
+ statementList = bmsshipStatementService.getLossStatementList(mapValue);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ //添加索引
|
|
|
+ map.put("index", "get_loss_statement_list");
|
|
|
+ //添加id
|
|
|
+ map.put("indexId", "statementId");
|
|
|
+ statementList.add(map);
|
|
|
+ //新建索引
|
|
|
+ String s = JSON.toJSONString(statementList);
|
|
|
+ esFeign.insertIndex(statementList);
|
|
|
+ //删除
|
|
|
+ statementList.remove(statementList.size() - 1);
|
|
|
+ }
|
|
|
+ if (statementList == null) {
|
|
|
+ statementList = bmsshipStatementService.getLossStatementList(mapValue);
|
|
|
+ }
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
//分页查询数据
|
|
|
List<Map<String, Object>> columnList = bmsshipStatementService.getLossStatementList(mapValue);
|
|
|
- PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
|
|
|
+ PageListAdd data = columnDataUtil.tableColumnData(apiId, statementList, columnList);
|
|
|
return success(data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 展示水分质检实绩
|
|
|
+ *
|
|
|
* @param mapValue
|
|
|
* @param pageNum
|
|
|
* @param pageSize
|
|
|
@@ -108,10 +173,10 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
@ApiImplicitParam(name = "apiId", value = "114", required = false, dataType = "BigDecimal")
|
|
|
})
|
|
|
@PostMapping("/getWaterResult")
|
|
|
- public RESTfulResult getWaterResult(@RequestBody(required = false) Map<String,Object> mapValue,
|
|
|
- Integer pageNum,
|
|
|
- Integer pageSize,
|
|
|
- Integer apiId) {
|
|
|
+ public RESTfulResult getWaterResult(@RequestBody(required = false) Map<String, Object> mapValue,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize,
|
|
|
+ Integer apiId) {
|
|
|
List<Map<String, Object>> list = bmsshipStatementService.getWaterResult(mapValue);
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
//分页查询数据
|
|
|
@@ -122,6 +187,7 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
|
|
|
/**
|
|
|
* 展示批次信息
|
|
|
+ *
|
|
|
* @param mapValue
|
|
|
* @param pageNum
|
|
|
* @param pageSize
|
|
|
@@ -135,20 +201,50 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
@ApiImplicitParam(name = "apiId", value = "115", required = false, dataType = "BigDecimal")
|
|
|
})
|
|
|
@PostMapping("/getBatch")
|
|
|
- public RESTfulResult getBatch(@RequestBody(required = false) Map<String,Object> mapValue,
|
|
|
- Integer pageNum,
|
|
|
- Integer pageSize,
|
|
|
- Integer apiId) {
|
|
|
- List<Map<String, Object>> list = bmsshipStatementService.getBatch(mapValue);
|
|
|
+ public RESTfulResult getBatch(@RequestBody(required = false) Map<String, Object> mapValue,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize,
|
|
|
+ Integer apiId,
|
|
|
+ String con) {
|
|
|
+ if (con != null) {
|
|
|
+ if (!"undefined".equals(con)) {
|
|
|
+ //设置要查询的索引名称
|
|
|
+ String index = "get_batch_list";
|
|
|
+ //获取查询结果
|
|
|
+ return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //初始化过滤
|
|
|
+ List<Map<String, Object>> batchList = null;
|
|
|
+ //如果有条件查询则跳过初始化,和创建索引
|
|
|
+ if (mapValue.size() == 0) {
|
|
|
+ //将查询结果存入索引中
|
|
|
+ batchList = bmsshipStatementService.getBatch(mapValue);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ //添加索引
|
|
|
+ map.put("index", "get_batch_list");
|
|
|
+ //添加id
|
|
|
+ map.put("indexId", "batchId");
|
|
|
+ batchList.add(map);
|
|
|
+ //新建索引
|
|
|
+ String s = JSON.toJSONString(batchList);
|
|
|
+ esFeign.insertIndex(batchList);
|
|
|
+ //删除
|
|
|
+ batchList.remove(batchList.size() - 1);
|
|
|
+ }
|
|
|
+ if (batchList == null) {
|
|
|
+ batchList = bmsshipStatementService.getBatch(mapValue);
|
|
|
+ }
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
//分页查询数据
|
|
|
List<Map<String, Object>> columnList = bmsshipStatementService.getBatch(mapValue);
|
|
|
- PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
|
|
|
+ PageListAdd data = columnDataUtil.tableColumnData(apiId, batchList, columnList);
|
|
|
return success(data);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 生成水运费账单
|
|
|
+ *
|
|
|
* @param mapList
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
@@ -158,13 +254,14 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
@ApiImplicitParam(name = "mapList", value = "详单列表", required = false, dataType = "java.util.List"),
|
|
|
})
|
|
|
@PostMapping("/addStatement")
|
|
|
- public RESTfulResult addStatement(@RequestBody List<Map<String,Object>> mapList) throws Exception {
|
|
|
+ public RESTfulResult addStatement(@RequestBody List<Map<String, Object>> mapList) throws Exception {
|
|
|
int code1 = bmsshipStatementService.insertSelective(mapList);
|
|
|
return success(code1);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 生成水分质检账单
|
|
|
+ *
|
|
|
* @param mapList
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
@@ -174,13 +271,14 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
@ApiImplicitParam(name = "mapList", value = "水分质检实绩列表", required = false, dataType = "java.util.List"),
|
|
|
})
|
|
|
@PostMapping("/addWaterStatement")
|
|
|
- public RESTfulResult addWaterStatement(@RequestBody List<Map<String,Object>> mapList) throws Exception {
|
|
|
+ public RESTfulResult addWaterStatement(@RequestBody List<Map<String, Object>> mapList) throws Exception {
|
|
|
int code = bmsshipStatementService.insertWaterFeesStatement(mapList);
|
|
|
return success(code);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 生成途损账单
|
|
|
+ *
|
|
|
* @param map
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
@@ -190,7 +288,7 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
@ApiImplicitParam(name = "map", value = "批次", required = false, dataType = "java.util.Map"),
|
|
|
})
|
|
|
@PostMapping("/addLossStatement")
|
|
|
- public RESTfulResult addLossStatement(@RequestBody Map<String,Object> map) throws Exception {
|
|
|
+ public RESTfulResult addLossStatement(@RequestBody Map<String, Object> map) throws Exception {
|
|
|
Integer batchId = (Integer) map.get("batchId");
|
|
|
List<Map<String, Object>> calDataList = bmstruckFormulaService.getCalData(new BigDecimal(batchId));
|
|
|
Map<String, Object> calDataMap = calDataList.get(0);
|
|
|
@@ -198,7 +296,7 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
BigDecimal moistureContent = (BigDecimal) calDataMap.get("moistureContent");
|
|
|
BigDecimal count = (BigDecimal) calDataMap.get("count");
|
|
|
BigDecimal arrivalWeight = bmstruckFormulaService.getArrivalWeight(new BigDecimal(batchId));
|
|
|
- Double result = (shipWeight.doubleValue() * (1 - 0.015) * (1 - moistureContent.doubleValue()/count.doubleValue())) - (arrivalWeight.doubleValue() * (1 - 0.091));
|
|
|
+ Double result = (shipWeight.doubleValue() * (1 - 0.015) * (1 - moistureContent.doubleValue() / count.doubleValue())) - (arrivalWeight.doubleValue() * (1 - 0.091));
|
|
|
if (result > 0) {
|
|
|
bmsshipStatementService.insertLossStatement(new BigDecimal(batchId));
|
|
|
}
|
|
|
@@ -207,14 +305,15 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
|
|
|
/**
|
|
|
* 展示账单下的详单
|
|
|
+ *
|
|
|
* @param batchId
|
|
|
- * @param mapVal
|
|
|
+ * @param mapValue
|
|
|
* @param pageNum
|
|
|
* @param pageSize
|
|
|
* @param apiId
|
|
|
* @return
|
|
|
*/
|
|
|
- @ApiOperation(value="展示账单下的详单", notes="分页查询")
|
|
|
+ @ApiOperation(value = "展示账单下的详单", notes = "分页查询")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "batchId", value = "批次id", required = false, dataType = "BigDecimal"),
|
|
|
@ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
|
|
|
@@ -222,21 +321,47 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
@ApiImplicitParam(name = "apiId", value = "93", required = false, dataType = "BigDecimal"),
|
|
|
})
|
|
|
@PostMapping(value = "/getStatementDetailsOrderList")
|
|
|
- public RESTfulResult getStatementDetailsOrderList(BigDecimal batchId,@RequestBody(required = false) Map<String,Object> mapVal,
|
|
|
+ public RESTfulResult getStatementDetailsOrderList(BigDecimal batchId, @RequestBody(required = false) Map<String, Object> mapValue,
|
|
|
Integer pageNum,
|
|
|
Integer pageSize,
|
|
|
Integer apiId,
|
|
|
- BigDecimal statementId){
|
|
|
- if (mapVal==null) {
|
|
|
- mapVal = new HashMap<>();
|
|
|
+ BigDecimal statementId,
|
|
|
+ String con) {
|
|
|
+ mapValue.put("batchId", batchId);
|
|
|
+ mapValue.put("statementId", statementId);
|
|
|
+ if (con != null) {
|
|
|
+ if (!"undefined".equals(con)) {
|
|
|
+ //设置要查询的索引名称
|
|
|
+ String index = "get_statement_details_list";
|
|
|
+ //获取查询结果
|
|
|
+ return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //初始化过滤
|
|
|
+ List<Map<String, Object>> statementList = null;
|
|
|
+ //如果有条件查询则跳过初始化,和创建索引
|
|
|
+ if (mapValue.size() == 2) {
|
|
|
+ //将查询结果存入索引中
|
|
|
+ statementList = bmsshipStatementService.getDetailsOrder(mapValue);
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ //添加索引
|
|
|
+ map.put("index", "get_statement_details_list");
|
|
|
+ //添加id
|
|
|
+ map.put("indexId", "statementId");
|
|
|
+ statementList.add(map);
|
|
|
+ //新建索引
|
|
|
+ String s = JSON.toJSONString(statementList);
|
|
|
+ esFeign.insertIndex(statementList);
|
|
|
+ //删除
|
|
|
+ statementList.remove(statementList.size() - 1);
|
|
|
+ }
|
|
|
+ if (statementList == null) {
|
|
|
+ statementList = bmsshipStatementService.getLossStatementList(mapValue);
|
|
|
}
|
|
|
- mapVal.put("batchId",batchId);
|
|
|
- mapVal.put("statementId",statementId);
|
|
|
- List<Map<String,Object>> list = bmsshipStatementService.getDetailsOrder(mapVal);
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
//分页查询数据
|
|
|
- List<Map<String, Object>> columnList = bmsshipStatementService.getDetailsOrder(mapVal);
|
|
|
- PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
|
|
|
+ List<Map<String, Object>> columnList = bmsshipStatementService.getDetailsOrder(mapValue);
|
|
|
+ PageListAdd data = columnDataUtil.tableColumnData(apiId, statementList, columnList);
|
|
|
return success(data);
|
|
|
}
|
|
|
|
|
|
@@ -272,6 +397,7 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
|
|
|
/**
|
|
|
* 展示详单下的船运实绩
|
|
|
+ *
|
|
|
* @param batchId
|
|
|
* @param mapVal
|
|
|
* @param pageNum
|
|
|
@@ -279,23 +405,23 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
* @param apiId
|
|
|
* @return
|
|
|
*/
|
|
|
- @ApiOperation(value="展示详单下的船运实绩", notes="分页查询")
|
|
|
+ @ApiOperation(value = "展示详单下的船运实绩", notes = "分页查询")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(name = "batchId", value = "账单id", required = false, dataType = "BigDecimal",paramType = "path"),
|
|
|
+ @ApiImplicitParam(name = "batchId", value = "账单id", required = false, dataType = "BigDecimal", paramType = "path"),
|
|
|
@ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
|
|
|
@ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
|
|
|
@ApiImplicitParam(name = "apiId", value = "112", required = false, dataType = "BigDecimal"),
|
|
|
})
|
|
|
@PostMapping(value = "/getShipResult")
|
|
|
- public RESTfulResult getShipResult(BigDecimal batchId,@RequestBody(required = false) Map<String,Object> mapVal,
|
|
|
- Integer pageNum,
|
|
|
- Integer pageSize,
|
|
|
- Integer apiId){
|
|
|
- if (mapVal==null) {
|
|
|
+ public RESTfulResult getShipResult(BigDecimal batchId, @RequestBody(required = false) Map<String, Object> mapVal,
|
|
|
+ Integer pageNum,
|
|
|
+ Integer pageSize,
|
|
|
+ Integer apiId) {
|
|
|
+ if (mapVal == null) {
|
|
|
mapVal = new HashMap<>();
|
|
|
}
|
|
|
- mapVal.put("batchId",batchId);
|
|
|
- List<Map<String,Object>> list = bmsshipStatementService.getShipResult(mapVal);
|
|
|
+ mapVal.put("batchId", batchId);
|
|
|
+ List<Map<String, Object>> list = bmsshipStatementService.getShipResult(mapVal);
|
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
|
//分页查询数据
|
|
|
List<Map<String, Object>> columnList = bmsshipStatementService.getShipResult(mapVal);
|
|
|
@@ -304,5 +430,4 @@ public class BmsshipStatementController extends BaseRESTfulController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
}
|