|
@@ -102,7 +102,9 @@ public class BizWorkOrderController extends BaseController {
|
|
if (!bizWorkOrder.getCompanyName().equals(""))
|
|
if (!bizWorkOrder.getCompanyName().equals(""))
|
|
bizWorkOrder.setCompanyName(bizWorkOrder.getCompanyName().trim());
|
|
bizWorkOrder.setCompanyName(bizWorkOrder.getCompanyName().trim());
|
|
}
|
|
}
|
|
- List<BizWorkOrder> list = bizWorkOrderService.getList(bizWorkOrder);
|
|
|
|
|
|
+// List<BizWorkOrder> list = bizWorkOrderService.getList(bizWorkOrder);
|
|
|
|
+ //有合并工单情况 不可以用合同明细联查
|
|
|
|
+ List<BizWorkOrder> list = bizWorkOrderService.getList2(bizWorkOrder);
|
|
BizEntrust entrustConditions = new BizEntrust();
|
|
BizEntrust entrustConditions = new BizEntrust();
|
|
entrustConditions.setWorkOrderIds(list.stream().map(BizWorkOrder::getId).collect(Collectors.toList()));
|
|
entrustConditions.setWorkOrderIds(list.stream().map(BizWorkOrder::getId).collect(Collectors.toList()));
|
|
List<BizEntrust> entrusts = entrustService.getList(entrustConditions);
|
|
List<BizEntrust> entrusts = entrustService.getList(entrustConditions);
|
|
@@ -146,7 +148,7 @@ public class BizWorkOrderController extends BaseController {
|
|
//判断是否全部收款
|
|
//判断是否全部收款
|
|
if (collectionMoney.compareTo(money) == 0) {
|
|
if (collectionMoney.compareTo(money) == 0) {
|
|
v.setOnceContractStatus("已收款");
|
|
v.setOnceContractStatus("已收款");
|
|
- } else if (collectionMoney.compareTo(money) < 0 &&collectionMoney.compareTo(new BigDecimal(0))>0) {
|
|
|
|
|
|
+ } else if (collectionMoney.compareTo(money) < 0 && collectionMoney.compareTo(new BigDecimal(0)) > 0) {
|
|
v.setOnceContractStatus("部分收款");
|
|
v.setOnceContractStatus("部分收款");
|
|
} else if (collectionMoney.compareTo(new BigDecimal(0)) == 0) {
|
|
} else if (collectionMoney.compareTo(new BigDecimal(0)) == 0) {
|
|
v.setOnceContractStatus("未收款");
|
|
v.setOnceContractStatus("未收款");
|
|
@@ -156,10 +158,13 @@ public class BizWorkOrderController extends BaseController {
|
|
if (v.getType() == 1 && detailList.size() > 0) {
|
|
if (v.getType() == 1 && detailList.size() > 0) {
|
|
|
|
|
|
//判断是否有起始月份
|
|
//判断是否有起始月份
|
|
- BizArchiveInputDetail detail = new BizArchiveInputDetail();
|
|
|
|
- detail.setContractId(v.getContractId());
|
|
|
|
- detail.setTaskTypeId(v.getTaskTypeId());
|
|
|
|
- detail = bizArchiveInputDetailService.getDetail(detail);
|
|
|
|
|
|
+// BizArchiveInputDetail detail = new BizArchiveInputDetail();
|
|
|
|
+//// detail.setContractId(v.getContractId());
|
|
|
|
+// detail.setFromId(0L);
|
|
|
|
+// detail.setCompanyId(v.getCompanyId());
|
|
|
|
+// detail.setDeleted(0);
|
|
|
|
+// detail.setTaskTypeId(v.getTaskTypeId());
|
|
|
|
+// detail = bizArchiveInputDetailService.getDetail(detail);
|
|
Integer monthNum = 0;
|
|
Integer monthNum = 0;
|
|
if (v.getStartMonth() != null) {
|
|
if (v.getStartMonth() != null) {
|
|
|
|
|
|
@@ -206,11 +211,15 @@ public class BizWorkOrderController extends BaseController {
|
|
} else {
|
|
} else {
|
|
//根据单价计算月数
|
|
//根据单价计算月数
|
|
for (BizWorkOrderDetail d : detailList) {
|
|
for (BizWorkOrderDetail d : detailList) {
|
|
|
|
+ Long contractDetailId = d.getContractDetailId();
|
|
|
|
+ //判断是否有起始月份
|
|
|
|
+
|
|
|
|
+ BizArchiveInputDetail detail = bizArchiveInputDetailService.getById(contractDetailId);
|
|
// 该明细的合同总金额
|
|
// 该明细的合同总金额
|
|
BizArchiveInput e = bizArchiveInputService.getById(d.getContractId());
|
|
BizArchiveInput e = bizArchiveInputService.getById(d.getContractId());
|
|
money = e.getAmount();
|
|
money = e.getAmount();
|
|
//如果收款金额大于0
|
|
//如果收款金额大于0
|
|
- if (d.getTotalityMoney() != null && d.getTotalityMoney().compareTo(new BigDecimal(0)) > 0 && d.getServiceNum()>0) {
|
|
|
|
|
|
+ if (d.getTotalityMoney() != null && d.getTotalityMoney().compareTo(new BigDecimal(0)) > 0 && d.getServiceNum() > 0) {
|
|
detail.setContractId(d.getContractId());
|
|
detail.setContractId(d.getContractId());
|
|
detail.setTaskTypeId(d.getTaskTypeId());
|
|
detail.setTaskTypeId(d.getTaskTypeId());
|
|
detail = bizArchiveInputDetailService.getDetail(detail);
|
|
detail = bizArchiveInputDetailService.getDetail(detail);
|
|
@@ -220,12 +229,13 @@ public class BizWorkOrderController extends BaseController {
|
|
if (money.compareTo(BigDecimal.ZERO) == 0) {
|
|
if (money.compareTo(BigDecimal.ZERO) == 0) {
|
|
monthNum = monthNum + detail.getServiceNum() + detail.getFreeNum();
|
|
monthNum = monthNum + detail.getServiceNum() + detail.getFreeNum();
|
|
}
|
|
}
|
|
|
|
+ //判断收款月数是否等于服务月数
|
|
|
|
+ if (detail.getServiceNum() == monthNum) {
|
|
|
|
+ //如果服务月数等于收款月数则加上赠送月数
|
|
|
|
+ monthNum += detail.getFreeNum();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- //判断收款月数是否等于服务月数
|
|
|
|
- if (detail.getServiceNum() == monthNum) {
|
|
|
|
- //如果服务月数等于收款月数则加上赠送月数
|
|
|
|
- monthNum += detail.getFreeNum();
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
//设置收款截止月
|
|
//设置收款截止月
|
|
Calendar rightNow = Calendar.getInstance();
|
|
Calendar rightNow = Calendar.getInstance();
|
|
rightNow.setTime(v.getStartMonth());
|
|
rightNow.setTime(v.getStartMonth());
|
|
@@ -379,9 +389,9 @@ public class BizWorkOrderController extends BaseController {
|
|
Long id = item.getId();
|
|
Long id = item.getId();
|
|
Long companyId = item.getCompanyId();
|
|
Long companyId = item.getCompanyId();
|
|
List<BizEntrust> bizEntrusts = entrustService.list(new LambdaQueryWrapper<BizEntrust>().eq(BizEntrust::getWorkOrderId, id).eq(BizEntrust::getCompanyId, companyId));
|
|
List<BizEntrust> bizEntrusts = entrustService.list(new LambdaQueryWrapper<BizEntrust>().eq(BizEntrust::getWorkOrderId, id).eq(BizEntrust::getCompanyId, companyId));
|
|
- if (!CollectionUtils.isEmpty(bizEntrusts)){
|
|
|
|
- String compName = companyService.getById(companyId).getName();
|
|
|
|
- return error( compName + "该工单已经委托给工厂,请先取消委托!");
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(bizEntrusts)) {
|
|
|
|
+ String compName = companyService.getById(companyId).getName();
|
|
|
|
+ return error(compName + "该工单已经委托给工厂,请先取消委托!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return toAjax(bizWorkOrderService.removeBatchByIds(list));
|
|
return toAjax(bizWorkOrderService.removeBatchByIds(list));
|