|
@@ -1,5 +1,6 @@
|
|
|
package com.steerinfo.dil.service.impl;
|
|
|
|
|
|
+import com.steerinfo.dil.feign.JoinApiFeign;
|
|
|
import com.steerinfo.dil.mapper.BmstrainStatementMapper;
|
|
|
import com.steerinfo.dil.model.BmstrainDetailsOrder;
|
|
|
import com.steerinfo.dil.model.BmstrainDetailsStatement;
|
|
@@ -8,6 +9,7 @@ import com.steerinfo.dil.service.IBmstrainStatementService;
|
|
|
import com.steerinfo.dil.util.NoUtil;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.text.DecimalFormat;
|
|
@@ -32,9 +34,12 @@ public class BmstrainStatementServiceImpl implements IBmstrainStatementService {
|
|
|
BmstrainDetailsStatementServiceImpl bmstrainDetailsStatementService;
|
|
|
@Autowired
|
|
|
NoUtil noUtil;
|
|
|
+ @Autowired
|
|
|
+ JoinApiFeign joinApiFeign;
|
|
|
|
|
|
/**
|
|
|
* 查询最大id
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
@@ -44,6 +49,7 @@ public class BmstrainStatementServiceImpl implements IBmstrainStatementService {
|
|
|
|
|
|
/**
|
|
|
* 展示账单列表
|
|
|
+ *
|
|
|
* @param mapValue
|
|
|
* @return
|
|
|
*/
|
|
@@ -51,41 +57,43 @@ public class BmstrainStatementServiceImpl implements IBmstrainStatementService {
|
|
|
public List<Map<String, Object>> getTrainStatementList(Map<String, Object> mapValue) {
|
|
|
List<Map<String, Object>> listMap = bmstrainStatementMapper.getTrainStatementList(mapValue);
|
|
|
// 将下浮后金额及保证金存入进map
|
|
|
- for (Map<String,Object> map : listMap) {
|
|
|
+ for (Map<String, Object> map : listMap) {
|
|
|
BigDecimal statementTotalAmount = (BigDecimal) map.get("statementTotalAmount");
|
|
|
Double floatAmount = statementTotalAmount.doubleValue() * 0.8;
|
|
|
Double maginAmount = statementTotalAmount.doubleValue() * 0.2;
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
String statementFloatAmount = df.format(floatAmount);
|
|
|
String statementMaginAmount = df.format(maginAmount);
|
|
|
- map.put("statementFloatAmount",statementFloatAmount);
|
|
|
- map.put("statementMaginAmount",statementMaginAmount);
|
|
|
+ map.put("statementFloatAmount", statementFloatAmount);
|
|
|
+ map.put("statementMaginAmount", statementMaginAmount);
|
|
|
}
|
|
|
return listMap;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 生成账单
|
|
|
- * @param mapList
|
|
|
+ *
|
|
|
+ * @param mapLists
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Transactional
|
|
|
@Override
|
|
|
- public int insertSelective(List<Map<String,Object>> mapList) {
|
|
|
+ public int insertSelective(List<Map<String, Object>> mapLists) {
|
|
|
BmstrainStatement bmstrainStatement = new BmstrainStatement();
|
|
|
- // 设置主键
|
|
|
- BigDecimal statementId = selectMaxId();
|
|
|
- bmstrainStatement.setStatementId(statementId);
|
|
|
- // 设置账单编号
|
|
|
- String statementNo = noUtil.setResultNo("HYZD", statementId);
|
|
|
- bmstrainStatement.setStatementNo(statementNo);
|
|
|
- bmstrainStatement.setStatementShipperId(new BigDecimal(1));
|
|
|
- Double totalAmount = new Double(0);
|
|
|
- for (int i = 0;i < mapList.size();i++) {
|
|
|
- Map<String,Object> map = mapList.get(i);
|
|
|
- Double detailsAmount = (Double) map.get("detailsAmount");
|
|
|
- totalAmount += detailsAmount;
|
|
|
- // 新增关系
|
|
|
- BmstrainDetailsStatement bmstrainDetailsStatement = new BmstrainDetailsStatement();
|
|
|
+ // 设置主键
|
|
|
+ BigDecimal statementId = selectMaxId();
|
|
|
+ bmstrainStatement.setStatementId(statementId);
|
|
|
+ // 设置账单编号
|
|
|
+ String statementNo = noUtil.setResultNo("HYZD", statementId);
|
|
|
+ bmstrainStatement.setStatementNo(statementNo);
|
|
|
+ bmstrainStatement.setStatementShipperId(new BigDecimal(1));
|
|
|
+ Double totalAmount = new Double(0);
|
|
|
+ for (int i = 0; i < mapLists.size(); i++) {
|
|
|
+ Map<String, Object> map = mapLists.get(i);
|
|
|
+ Double detailsAmount = (Double) map.get("detailsAmount");
|
|
|
+ totalAmount += detailsAmount;
|
|
|
+ // 新增关系
|
|
|
+ BmstrainDetailsStatement bmstrainDetailsStatement = new BmstrainDetailsStatement();
|
|
|
bmstrainDetailsStatement.setDetailsStatementId(bmstrainDetailsStatementService.selectMaxId());
|
|
|
BigDecimal detailsId = new BigDecimal((Integer) map.get("detailsId"));
|
|
|
bmstrainDetailsStatement.setDetailsId(detailsId);
|
|
@@ -110,11 +118,17 @@ public class BmstrainStatementServiceImpl implements IBmstrainStatementService {
|
|
|
bmstrainStatement.setUpdateTime(new Date());
|
|
|
bmstrainStatement.setUpdateUsername("admin");
|
|
|
bmstrainStatement.setInsertUpdateRemark("无");
|
|
|
- return bmstrainStatementMapper.insertSelective(bmstrainStatement);
|
|
|
+ int code = bmstrainStatementMapper.insertSelective(bmstrainStatement);
|
|
|
+ // 调用金蝶接口
|
|
|
+ List<Map<String, Object>> mapList = joinApiFeign.getPurchaseTrainDetailsOrder(statementId.intValue());
|
|
|
+ Map<String, Object> mapValue = joinApiFeign.getTrainStatement(statementId.intValue());
|
|
|
+ mapValue.put("mapList", mapList);
|
|
|
+ return code;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 展示账单中的详单
|
|
|
+ * 展示账单中的详单
|
|
|
+ *
|
|
|
* @param mapValue
|
|
|
* @return
|
|
|
*/
|
|
@@ -125,6 +139,7 @@ public class BmstrainStatementServiceImpl implements IBmstrainStatementService {
|
|
|
|
|
|
/**
|
|
|
* 展示火运实绩
|
|
|
+ *
|
|
|
* @param mapValue
|
|
|
* @return
|
|
|
*/
|