|
@@ -22,6 +22,7 @@ import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* BmstruckStatement服务实现:
|
|
|
+ *
|
|
|
* @author generator
|
|
|
* @version 1.0-SNAPSHORT 2021-10-15 06:20
|
|
|
* 类描述
|
|
@@ -30,8 +31,8 @@ import java.util.Map;
|
|
|
* 作者:generator
|
|
|
* 参考:
|
|
|
* 描述:BmstruckStatement服务实现
|
|
|
- * @see null
|
|
|
* @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
|
|
|
+ * @see null
|
|
|
*/
|
|
|
@Service(value = "bmstruckStatementService")
|
|
|
public class BmstruckStatementServiceImpl implements IBmstruckStatementService {
|
|
@@ -49,6 +50,7 @@ public class BmstruckStatementServiceImpl implements IBmstruckStatementService {
|
|
|
|
|
|
/**
|
|
|
* 展示计费账单
|
|
|
+ *
|
|
|
* @param mapValue
|
|
|
* @return
|
|
|
*/
|
|
@@ -56,33 +58,34 @@ public class BmstruckStatementServiceImpl implements IBmstruckStatementService {
|
|
|
public List<Map<String, Object>> getTruckStatementList(Map<String, Object> mapValue) {
|
|
|
List<Map<String, Object>> mapList = bmstruckStatementMapper.getTruckStatementList(mapValue);
|
|
|
String checkStatus = "";
|
|
|
- for (Map<String,Object> map: mapList) {
|
|
|
+ for (Map<String, Object> map : mapList) {
|
|
|
BigDecimal checkCarrierStatus = (BigDecimal) map.get("checkCarrierStatus");
|
|
|
BigDecimal checkReceiveCustomerStatus = (BigDecimal) map.get("checkReceiveCustomerStatus");
|
|
|
BigDecimal checkShipperStatus = (BigDecimal) map.get("checkShipperStatus");
|
|
|
- // 有人拒绝:未通过审核
|
|
|
- if (checkCarrierStatus != null || checkReceiveCustomerStatus != null || checkShipperStatus != null && (checkCarrierStatus.intValue() == 0 || checkReceiveCustomerStatus.intValue() == 0 || checkShipperStatus.intValue() == 0)){
|
|
|
+ if (checkCarrierStatus.intValue() == 1 || checkReceiveCustomerStatus.intValue() == 1 || checkShipperStatus.intValue() == 1) {
|
|
|
checkStatus = "未通过审核";
|
|
|
}
|
|
|
// 全部通过:已通过审核
|
|
|
- if (checkCarrierStatus != null || checkReceiveCustomerStatus != null || checkShipperStatus != null && (checkCarrierStatus.intValue() == 1 && checkReceiveCustomerStatus.intValue() == 1 && checkShipperStatus.intValue() == 1)) {
|
|
|
+ if (checkCarrierStatus.intValue() == 2 && checkReceiveCustomerStatus.intValue() == 2 && checkShipperStatus.intValue() == 2) {
|
|
|
checkStatus = "已通过审核";
|
|
|
}
|
|
|
// 有人未审核,且没人拒绝:审核中
|
|
|
- if (checkCarrierStatus != null || checkReceiveCustomerStatus != null || checkShipperStatus != null && checkStatus != "未通过审批"){
|
|
|
+ if (checkStatus != "未审核通过" && checkCarrierStatus.intValue() == 0 || checkReceiveCustomerStatus.intValue() == 0 || checkShipperStatus.intValue() == 0) {
|
|
|
checkStatus = "审核中";
|
|
|
}
|
|
|
// 全部都没审核:待审核
|
|
|
- if (checkCarrierStatus == null && checkReceiveCustomerStatus == null && checkShipperStatus == null) {
|
|
|
+ if (checkCarrierStatus.intValue() == 0 && checkReceiveCustomerStatus.intValue() == 0 && checkShipperStatus.intValue() == 0) {
|
|
|
checkStatus = "待审核";
|
|
|
}
|
|
|
- map.put("checkStatus",checkStatus);
|
|
|
+ map.put("checkStatus", checkStatus);
|
|
|
}
|
|
|
return mapList;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 生成汽运账单
|
|
|
+ *
|
|
|
* @param mapList
|
|
|
* @return
|
|
|
*/
|
|
@@ -97,9 +100,12 @@ public class BmstruckStatementServiceImpl implements IBmstruckStatementService {
|
|
|
BigDecimal checkId = bmstruckCheckMapper.selectCheckId();
|
|
|
bmstruckCheck.setCheckId(checkId);
|
|
|
bmstruckCheck.setStatementId(statementId);
|
|
|
+ bmstruckCheck.setCheckCarrierStatus(new BigDecimal(0));
|
|
|
+ bmstruckCheck.setCheckShipperStatus(new BigDecimal(0));
|
|
|
+ bmstruckCheck.setCheckReceiveCustomerStatus(new BigDecimal(0));
|
|
|
bmstruckCheckMapper.insertSelective(bmstruckCheck);
|
|
|
// 汽运账单编号
|
|
|
- String statementNumber = noUtil.setResultNo("QYZD",statementId);
|
|
|
+ String statementNumber = noUtil.setResultNo("QYZD", statementId);
|
|
|
bmstruckStatement.setStatementNumber(statementNumber);
|
|
|
// 支付单位
|
|
|
bmstruckStatement.setStatementPaymentUnit("四川达州钢铁集团有限责任公司");
|
|
@@ -112,7 +118,7 @@ public class BmstruckStatementServiceImpl implements IBmstruckStatementService {
|
|
|
bmstruckStatement.setUpdateUsername("admin");
|
|
|
bmstruckStatement.setInsertUpdateRemark("无");
|
|
|
Double doubleTotalAmount = new Double(0);
|
|
|
- for (Map<String,Object> map: mapList ) {
|
|
|
+ for (Map<String, Object> map : mapList) {
|
|
|
// 中间表主键
|
|
|
BigDecimal detailsStatementId = bmstruckDetailsStatementMapper.selectDetailsStatementId();
|
|
|
// 详单id
|
|
@@ -130,7 +136,7 @@ public class BmstruckStatementServiceImpl implements IBmstruckStatementService {
|
|
|
bmstruckDetailsStatement.setUpdateTime(new Date());
|
|
|
bmstruckDetailsStatement.setUpdateUsername("admin");
|
|
|
bmstruckDetailsStatement.setInsertUpdateRemark("无");
|
|
|
- BigDecimal detailsAmount = new BigDecimal((Integer)map.get("detailsAmount"));
|
|
|
+ BigDecimal detailsAmount = new BigDecimal((Double) map.get("detailsAmount"));
|
|
|
Double detailsAmountDouble = Double.valueOf(detailsAmount.toString());
|
|
|
doubleTotalAmount += detailsAmountDouble;
|
|
|
bmstruckDetailsStatementMapper.insertSelective(bmstruckDetailsStatement);
|
|
@@ -143,6 +149,7 @@ public class BmstruckStatementServiceImpl implements IBmstruckStatementService {
|
|
|
|
|
|
/**
|
|
|
* 展示账单下的详单
|
|
|
+ *
|
|
|
* @param mapVal
|
|
|
* @return
|
|
|
*/
|
|
@@ -150,4 +157,95 @@ public class BmstruckStatementServiceImpl implements IBmstruckStatementService {
|
|
|
public List<Map<String, Object>> getSaleTruckStatementDetailsOrderList(Map<String, Object> mapVal) {
|
|
|
return bmstruckStatementMapper.getSaleTruckStatementDetailsOrderList(mapVal);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增内转汽运账单
|
|
|
+ *
|
|
|
+ * @param mapList
|
|
|
+ * @param orderType
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public int addConvertedTruckStatement(List<Map<String, Object>> mapList, Integer orderType) {
|
|
|
+ //orderType:1:计时,2:计数,3:计重,4:包月
|
|
|
+ // 生成汽运账单主键
|
|
|
+ BigDecimal statementId = bmstruckStatementMapper.selectStatementId();
|
|
|
+ // 创建账单实体
|
|
|
+ BmstruckStatement bmstruckStatement = new BmstruckStatement();
|
|
|
+ // 常规字段
|
|
|
+ bmstruckStatement.setInsertTime(new Date());
|
|
|
+ bmstruckStatement.setInsertUsername("admin");
|
|
|
+ bmstruckStatement.setInsertUpdateRemark("无");
|
|
|
+ // 计算账单总金额
|
|
|
+ Double doubleTotalAmount = new Double(0);
|
|
|
+ //将详单id与账单id绑定至中间表
|
|
|
+ for (Map<String, Object> map : mapList) {
|
|
|
+ // 中间表主键
|
|
|
+ BigDecimal detailsStatementId = bmstruckDetailsStatementMapper.selectDetailsStatementId();
|
|
|
+ // 详单id
|
|
|
+ BigDecimal detailsId = new BigDecimal((Integer) map.get("detailsId"));
|
|
|
+ // 获取详单信息
|
|
|
+ BmstruckDetailsOrder bmstruckDetailsOrder = bmstruckDetailsOrderMapper.selectByPrimaryKey(detailsId);
|
|
|
+ // 将该详单状态变为已生成账单
|
|
|
+ bmstruckDetailsOrder.setWetherToStatement(new BigDecimal(1));
|
|
|
+ bmstruckDetailsOrder.setUpdateTime(new Date());
|
|
|
+ bmstruckDetailsOrder.setUpdateUsername("admin");
|
|
|
+ // 修改详单信息
|
|
|
+ bmstruckDetailsOrderMapper.updateByPrimaryKeySelective(bmstruckDetailsOrder);
|
|
|
+ // 新增中间表实体
|
|
|
+ BmstruckDetailsStatement bmstruckDetailsStatement = new BmstruckDetailsStatement();
|
|
|
+ //设置主键
|
|
|
+ bmstruckDetailsStatement.setDetailsStatementId(detailsStatementId);
|
|
|
+ bmstruckDetailsStatement.setStatementId(statementId);
|
|
|
+ bmstruckDetailsStatement.setDetailsId(detailsId);
|
|
|
+ // 设置常规字段
|
|
|
+ bmstruckDetailsStatement.setInsertTime(new Date());
|
|
|
+ bmstruckDetailsStatement.setInsertUsername("admin");
|
|
|
+ bmstruckDetailsStatement.setInsertUpdateRemark("无");
|
|
|
+ BigDecimal detailsAmount = new BigDecimal((Double) map.get("detailsAmount"));
|
|
|
+ Double detailsAmountDouble = Double.valueOf(detailsAmount.toString());
|
|
|
+ doubleTotalAmount += detailsAmountDouble;
|
|
|
+ bmstruckDetailsStatementMapper.insertSelective(bmstruckDetailsStatement);
|
|
|
+ }
|
|
|
+ if (orderType == 1) {
|
|
|
+ // 备注
|
|
|
+ bmstruckStatement.setStatementRemark("计时汽运费账单");
|
|
|
+ } else if (orderType == 2) {
|
|
|
+ // 备注
|
|
|
+ bmstruckStatement.setStatementRemark("计数汽运费账单");
|
|
|
+ } else if (orderType == 3) {
|
|
|
+ // 备注
|
|
|
+ bmstruckStatement.setStatementRemark("计重汽运费账单");
|
|
|
+ } else if (orderType == 4) {
|
|
|
+ // 备注
|
|
|
+ bmstruckStatement.setStatementRemark("包月汽运费账单");
|
|
|
+ }
|
|
|
+ bmstruckStatement.setStatementExcludTax(new BigDecimal(doubleTotalAmount));
|
|
|
+ return bmstruckStatementMapper.insertSelective(bmstruckStatement);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int delete(BigDecimal statementId) {
|
|
|
+ //通过账单id获取详单
|
|
|
+ List<BigDecimal> list = bmstruckStatementMapper.getDetailById(statementId);
|
|
|
+ for (BigDecimal detailsId : list
|
|
|
+ ) {
|
|
|
+ BmstruckDetailsOrder bmstruckDetailsOrder = new BmstruckDetailsOrder();
|
|
|
+ bmstruckDetailsOrder.setDetailsId(detailsId);
|
|
|
+ bmstruckDetailsOrder.setWetherToStatement(new BigDecimal(0));
|
|
|
+ bmstruckDetailsOrder.setUpdateTime(new Date());
|
|
|
+ bmstruckDetailsOrder.setUpdateUsername("admin");
|
|
|
+ bmstruckDetailsOrderMapper.updateByPrimaryKeySelective(bmstruckDetailsOrder);
|
|
|
+ }
|
|
|
+ return bmstruckStatementMapper.deleteByPrimaryKey(statementId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int update(BigDecimal statementId) {
|
|
|
+ BmstruckStatement bmstruckStatement = new BmstruckStatement();
|
|
|
+ bmstruckStatement.setStatementType(new BigDecimal(1));
|
|
|
+ bmstruckStatement.setUpdateTime(new Date());
|
|
|
+ bmstruckStatement.setUpdateUsername("admin");
|
|
|
+ return bmstruckStatementMapper.updateByPrimaryKeySelective(bmstruckStatement);
|
|
|
+ }
|
|
|
}
|