|
@@ -394,7 +394,31 @@ public class PayOrderLogic {
|
|
|
if(workerOrder == null){
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
WorkerOrderDetail workerOrderDetail = BeanUtil.toBean(workerOrder, WorkerOrderDetail.class);
|
|
|
+
|
|
|
+ workerOrderDetail.setIfCancel(true);
|
|
|
+ if (!StringUtil.isEmpty(workerOrder.getWorkerOrderId())) {
|
|
|
+ WorkerOrder workerOrderOne = workerOrderService.lambdaQuery()
|
|
|
+ .isNotNull(WorkerOrder::getGreeOrderId)
|
|
|
+ .eq(WorkerOrder::getWorkerOrderId, workerOrderDetail.getWorkerOrderId())
|
|
|
+ .last("limit 1").one();
|
|
|
+ if (workerOrderOne != null){
|
|
|
+ Integer countWait = workerOrderService.lambdaQuery()
|
|
|
+ .ge(WorkerOrder::getTotalAmount, workerOrderOne.getTotalAmount())
|
|
|
+ .in(WorkerOrder::getPayStatus, PayStatusEnum.WAIT.getKey(),PayStatusEnum.PAID.getKey())
|
|
|
+ .eq(WorkerOrder::getWorkerOrderId, workerOrderDetail.getWorkerOrderId())
|
|
|
+ .count();
|
|
|
+
|
|
|
+ if (countWait < 2){
|
|
|
+ workerOrderDetail.setIfCancel(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
workerOrderDetail.setWorkerOrderItems(workerOrderItemService.lambdaQuery()
|
|
|
.eq(WorkerOrderItem::getOrderId,orderId).list());
|
|
|
return workerOrderDetail;
|
|
@@ -865,7 +889,7 @@ public class PayOrderLogic {
|
|
|
|
|
|
}
|
|
|
|
|
|
- public Page<WorkerOrder> orderPage(String workerOrderId,String yearMonth,String settlementType,String goodsType, String orderId, String startTime, String endTime, String payStatus, Integer pageNum, Integer pageSize) {
|
|
|
+ public Page<WorkerOrderDetail> orderPage(String workerOrderId,String yearMonth,String settlementType,String goodsType, String orderId, String startTime, String endTime, String payStatus, Integer pageNum, Integer pageSize) {
|
|
|
|
|
|
CurrentCompanyWechat currentCompanyWechat = commonLogic.getCurrentCompanyWechat();
|
|
|
String startMonTime = null;
|
|
@@ -879,24 +903,61 @@ public class PayOrderLogic {
|
|
|
if (StringUtil.isEmpty(currentCompanyWechat.getUser().getWorkerNumber()) && StringUtil.isEmpty(currentCompanyWechat.getUser().getIdCard()))
|
|
|
return new Page<>();
|
|
|
|
|
|
- return workerOrderService.lambdaQuery()
|
|
|
- .eq(!StringUtil.isEmpty(goodsType),WorkerOrder::getGoodsType,goodsType)
|
|
|
- .like(!StringUtil.isEmpty(settlementType),WorkerOrder::getSettlementType,settlementType)
|
|
|
- .eq(!StringUtil.isEmpty(orderId),WorkerOrder::getOrderId,orderId)
|
|
|
- .eq(!StringUtil.isEmpty(workerOrderId),WorkerOrder::getWorkerOrderId,workerOrderId)
|
|
|
- .and(!StringUtil.isEmpty(payStatus),item -> item
|
|
|
- .eq(!StringUtil.isEmpty(payStatus),WorkerOrder::getPayStatus,payStatus)
|
|
|
+ Page<WorkerOrder> page = workerOrderService.lambdaQuery()
|
|
|
+ .eq(!StringUtil.isEmpty(goodsType), WorkerOrder::getGoodsType, goodsType)
|
|
|
+ .like(!StringUtil.isEmpty(settlementType), WorkerOrder::getSettlementType, settlementType)
|
|
|
+ .eq(!StringUtil.isEmpty(orderId), WorkerOrder::getOrderId, orderId)
|
|
|
+ .eq(!StringUtil.isEmpty(workerOrderId), WorkerOrder::getWorkerOrderId, workerOrderId)
|
|
|
+ .and(!StringUtil.isEmpty(payStatus), item -> item
|
|
|
+ .eq(!StringUtil.isEmpty(payStatus), WorkerOrder::getPayStatus, payStatus)
|
|
|
|
|
|
- .or(!StringUtil.isEmpty(payStatus) && payStatus.equals(PayStatusEnum.CANCEL.getKey()),
|
|
|
- iter -> iter.eq(WorkerOrder::getRefundStatus, IsYesNoEnum.YES.getKey()))
|
|
|
+ .or(!StringUtil.isEmpty(payStatus) && payStatus.equals(PayStatusEnum.CANCEL.getKey()),
|
|
|
+ iter -> iter.eq(WorkerOrder::getRefundStatus, IsYesNoEnum.YES.getKey()))
|
|
|
)
|
|
|
- .eq(!StringUtil.isEmpty(payStatus) && payStatus.equals(MaterialExamineStatusEnum.PAID.getKey()),WorkerOrder::getRefundStatus, IsYesNoEnum.NO.getKey())
|
|
|
- .eq(!StringUtil.isEmpty(currentCompanyWechat.getUser().getWorkerNumber()),WorkerOrder::getWorkerNumber,currentCompanyWechat.getUser().getWorkerNumber())
|
|
|
- .eq(StringUtil.isEmpty(currentCompanyWechat.getUser().getWorkerNumber()),WorkerOrder::getIdentity,currentCompanyWechat.getUser().getIdCard())
|
|
|
- .between(!StringUtil.isEmpty(startTime),WorkerOrder::getCreateTime,startTime,endTime)
|
|
|
- .in(WorkerOrder::getCompanyWechatId,currentCompanyWechat.getCompanyWechatId())
|
|
|
+ .eq(!StringUtil.isEmpty(payStatus) && payStatus.equals(MaterialExamineStatusEnum.PAID.getKey()), WorkerOrder::getRefundStatus, IsYesNoEnum.NO.getKey())
|
|
|
+ .eq(!StringUtil.isEmpty(currentCompanyWechat.getUser().getWorkerNumber()), WorkerOrder::getWorkerNumber, currentCompanyWechat.getUser().getWorkerNumber())
|
|
|
+ .eq(StringUtil.isEmpty(currentCompanyWechat.getUser().getWorkerNumber()), WorkerOrder::getIdentity, currentCompanyWechat.getUser().getIdCard())
|
|
|
+ .between(!StringUtil.isEmpty(startTime), WorkerOrder::getCreateTime, startTime, endTime)
|
|
|
+ .in(WorkerOrder::getCompanyWechatId, currentCompanyWechat.getCompanyWechatId())
|
|
|
.orderByDesc(WorkerOrder::getCreateTime)
|
|
|
- .page(new Page<>(pageNum,pageSize));
|
|
|
+ .page(new Page<>(pageNum, pageSize));
|
|
|
+
|
|
|
+ Page<WorkerOrderDetail> workerOrderDetailPage = new Page<>();
|
|
|
+
|
|
|
+
|
|
|
+ workerOrderDetailPage.setTotal(page.getTotal());
|
|
|
+ workerOrderDetailPage.setCurrent(page.getCurrent());
|
|
|
+
|
|
|
+ List<WorkerOrderDetail> workerOrderDetails = new ArrayList<>();
|
|
|
+ for (WorkerOrder record : page.getRecords()) {
|
|
|
+ WorkerOrderDetail workerOrderDetail = BeanUtil.toBean(record, WorkerOrderDetail.class);
|
|
|
+
|
|
|
+ workerOrderDetail.setIfCancel(true);
|
|
|
+ if (!StringUtil.isEmpty(workerOrderDetail.getWorkerOrderId())) {
|
|
|
+ WorkerOrder workerOrder = workerOrderService.lambdaQuery()
|
|
|
+ .isNotNull(WorkerOrder::getGreeOrderId)
|
|
|
+ .eq(WorkerOrder::getWorkerOrderId, workerOrderDetail.getWorkerOrderId())
|
|
|
+ .last("limit 1").one();
|
|
|
+ if (workerOrder != null){
|
|
|
+ Integer countWait = workerOrderService.lambdaQuery()
|
|
|
+ .ge(WorkerOrder::getTotalAmount, workerOrder.getTotalAmount())
|
|
|
+ .in(WorkerOrder::getPayStatus, PayStatusEnum.WAIT.getKey(),PayStatusEnum.PAID.getKey())
|
|
|
+ .eq(WorkerOrder::getWorkerOrderId, workerOrderDetail.getWorkerOrderId())
|
|
|
+ .count();
|
|
|
+
|
|
|
+ if (countWait < 2){
|
|
|
+ workerOrderDetail.setIfCancel(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ workerOrderDetails.add(workerOrderDetail);
|
|
|
+ }
|
|
|
+
|
|
|
+ workerOrderDetailPage.setRecords(workerOrderDetails);
|
|
|
+
|
|
|
+ return workerOrderDetailPage;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1061,13 +1122,36 @@ public class PayOrderLogic {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void cancel(String orderId) {
|
|
|
if (workerOrderService.lambdaQuery().eq(WorkerOrder::getOrderId,orderId)
|
|
|
.eq(WorkerOrder::getPayStatus,"WAIT").count() < 1){
|
|
|
throw new RemoteServiceException("订单不属于未支付不可取消");
|
|
|
}
|
|
|
+ WorkerOrder workerOrder = workerOrderService.getById(orderId);
|
|
|
+
|
|
|
workerOrderService.lambdaUpdate().eq(WorkerOrder::getOrderId,orderId)
|
|
|
.set(WorkerOrder::getPayStatus,"CANCEL").update();
|
|
|
+
|
|
|
+ if (!StringUtil.isEmpty(workerOrder.getWorkerOrderId())) {
|
|
|
+ WorkerOrder workerOrderOne = workerOrderService.lambdaQuery()
|
|
|
+ .isNotNull(WorkerOrder::getGreeOrderId)
|
|
|
+ .eq(WorkerOrder::getWorkerOrderId, workerOrder.getWorkerOrderId())
|
|
|
+ .last("limit 1").one();
|
|
|
+ if (workerOrderOne != null){
|
|
|
+
|
|
|
+ Integer countWait = workerOrderService.lambdaQuery()
|
|
|
+ .ge(WorkerOrder::getTotalAmount, workerOrder.getTotalAmount())
|
|
|
+ .in(WorkerOrder::getPayStatus, PayStatusEnum.WAIT.getKey(),PayStatusEnum.PAID.getKey())
|
|
|
+ .eq(WorkerOrder::getWorkerOrderId, workerOrder.getWorkerOrderId())
|
|
|
+ .count();
|
|
|
+
|
|
|
+ if (countWait < 1)
|
|
|
+ throw new RemoteServiceException("存在4.0辅材支付单,请必须支付");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public List<SysDictCompany> sysDict(String dictType, String status) {
|