单独退租
This commit is contained in:
parent
bf1b71ad55
commit
9a98981b64
|
|
@ -85,7 +85,7 @@ public class OrderController extends BaseController {
|
|||
return error("参数错误");
|
||||
}
|
||||
// 退租
|
||||
if (orderInfoDto.getOrderStatus().equals(OrderStatusEnum.ORDER_UNDER_LEASE.getStatus())) {
|
||||
if (orderInfoDto.getOrderStatus().equals(OrderStatusEnum.ORDER_UNDER_LEASE.getStatus().toString())) {
|
||||
List<OrderDetailDto> dtos = orderMapper.getOrderDetailsByOrderId(orderInfoDto.getOrderId());
|
||||
if (dtos.size() > 0 && CollectionUtil.isNotEmpty(dtos)) {
|
||||
if (CollectionUtil.isNotEmpty(orderInfoDto.getMaIds())) {
|
||||
|
|
@ -104,7 +104,7 @@ public class OrderController extends BaseController {
|
|||
}
|
||||
}
|
||||
// 取消
|
||||
if (orderInfoDto.getOrderStatus().equals(OrderStatusEnum.ORDER_CANCEL.getStatus())) {
|
||||
if (orderInfoDto.getOrderStatus().equals(OrderStatusEnum.ORDER_CANCEL.getStatus().toString())) {
|
||||
List<OrderDetailDto> dtos = orderMapper.getOrderDetailsByOrderId(orderInfoDto.getOrderId());
|
||||
if (dtos.size() > 0 && CollectionUtil.isNotEmpty(dtos)) {
|
||||
for (OrderDetailDto dto : dtos) {
|
||||
|
|
@ -119,7 +119,7 @@ public class OrderController extends BaseController {
|
|||
}
|
||||
}
|
||||
}
|
||||
Integer i = orderMapper.updateOrderStatus(orderInfoDto.getOrderId(), orderInfoDto.getOrderStatus(), userName);
|
||||
Integer i = orderMapper.updateOrderStatus(orderInfoDto.getOrderId(), orderInfoDto.getMaIds(), orderInfoDto.getOrderStatus(), userName);
|
||||
if (i > 0) {
|
||||
return success();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@ public class OrderInfoDto {
|
|||
@ApiModelProperty(value = "主键id")
|
||||
private Integer orderId;
|
||||
|
||||
@ApiModelProperty(value = "设备id")
|
||||
private Integer maId;
|
||||
|
||||
@ApiModelProperty(value = "订单装备套数")
|
||||
private Integer maNumber;
|
||||
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ public interface OrderMapper {
|
|||
|
||||
void updateMaStatus(OrderDetailDto orderDetailDto);
|
||||
|
||||
Integer updateOrderStatus(@Param("orderId") Integer orderId, @Param("orderStatus") String orderStatus,@Param("userName") String userName);
|
||||
Integer updateOrderStatus(@Param("orderId") Integer orderId, @Param("maIds") List<Integer> maIds, @Param("orderStatus") String orderStatus,@Param("userName") String userName);
|
||||
|
||||
Integer updateDevCount(OrderDetailDto orderDetailDto);
|
||||
Integer updateAddDevCount(OrderDetailDto orderDetailDto);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.OptionalInt;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
|
|
@ -96,14 +98,11 @@ public class OrderServiceImpl implements OrderService {
|
|||
list.add(orderDetailDto);
|
||||
}
|
||||
dto.setDetailsList(list);
|
||||
boolean orderStatus = list.stream()
|
||||
.map(OrderDetailDto::getOrderStatus)
|
||||
.allMatch(name -> name.equals(list.get(0).getOrderStatus()));
|
||||
if (orderStatus) {
|
||||
dto.setOrderStatus(list.get(0).getOrderStatus());
|
||||
} else {
|
||||
throw new Exception("订单状态不一致,请检查订单状态");
|
||||
}
|
||||
Optional<OrderDetailDto> minOrderStatus = list.stream()
|
||||
.min((p1, p2) -> Integer.compare(Integer.parseInt(p1.getOrderStatus()), Integer.parseInt(p2.getOrderStatus())));
|
||||
if (minOrderStatus.isPresent()) {
|
||||
dto.setOrderStatus(minOrderStatus.get().getOrderStatus());
|
||||
}//TODO外层订单状态
|
||||
dto.setStartTime(list.get(0).getRentBeginTime());
|
||||
dto.setEndTime(list.get(0).getRentEndTime());
|
||||
//根据订单id去lease_repair_record表中查询是否已填写退租检修信息
|
||||
|
|
@ -126,9 +125,7 @@ public class OrderServiceImpl implements OrderService {
|
|||
.allMatch(name -> name.equals(list.get(0).getOrderStatus()));
|
||||
if (orderStatus) {
|
||||
orderInfoDto.setOrderStatus(list.get(0).getOrderStatus());
|
||||
} else {
|
||||
throw new Exception("订单状态不一致,请检查订单状态");
|
||||
}
|
||||
}//TODO外层订单状态
|
||||
orderInfoDto.setStartTime(list.get(0).getRentBeginTime());
|
||||
orderInfoDto.setEndTime(list.get(0).getRentEndTime());
|
||||
orderInfoDto.setDetailsList(list);
|
||||
|
|
|
|||
|
|
@ -62,6 +62,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
,refuse_time = now()
|
||||
</if>
|
||||
where order_id = #{orderId}
|
||||
<if test="maIds != null and maIds.size() > 0">
|
||||
and ma_id in
|
||||
<foreach item="item" collection="maIds" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</update>
|
||||
<update id="updateDevCount">
|
||||
update ma_dev_info set device_count = device_count - #{num} where ma_id = #{maId} and is_active = 1
|
||||
|
|
@ -91,7 +97,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
su.phonenumber AS phoneNumber,
|
||||
moi.address,
|
||||
moi.order_id,
|
||||
hh.ma_id as maId,
|
||||
sum(hh.costs) cost,
|
||||
dept.dept_name as companyName
|
||||
FROM
|
||||
|
|
@ -146,6 +151,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
hh.days,
|
||||
bfi.url,
|
||||
hh.id,
|
||||
hh.ma_id,
|
||||
hh.num,
|
||||
hh.costs,
|
||||
hh.rent_begin_time,
|
||||
|
|
|
|||
Loading…
Reference in New Issue