费用减免
This commit is contained in:
parent
00d4233e95
commit
907f7034ea
|
|
@ -8,6 +8,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
||||||
import com.bonus.common.core.web.page.TableDataInfo;
|
import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
import com.bonus.common.security.utils.SecurityUtils;
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.material.book.domain.BookCarInfoDto;
|
import com.bonus.material.book.domain.BookCarInfoDto;
|
||||||
|
import com.bonus.material.order.domain.OrderDetailCostReliefDto;
|
||||||
import com.bonus.material.order.domain.OrderDetailDto;
|
import com.bonus.material.order.domain.OrderDetailDto;
|
||||||
import com.bonus.material.order.domain.OrderInfoDto;
|
import com.bonus.material.order.domain.OrderInfoDto;
|
||||||
import com.bonus.material.order.mapper.OrderMapper;
|
import com.bonus.material.order.mapper.OrderMapper;
|
||||||
|
|
@ -127,5 +128,17 @@ public class OrderController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发起减免
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "发起减免")
|
||||||
|
@PostMapping("/costRelief")
|
||||||
|
public AjaxResult costRelief(@RequestBody OrderInfoDto orderInfoDto) {
|
||||||
|
Integer i = orderService.submitCostRelief(orderInfoDto);
|
||||||
|
if (i > 0) {
|
||||||
|
return success("发起减免成功");
|
||||||
|
} else {
|
||||||
|
return error("发起减免失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.bonus.material.order.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OrderDetailCostReliefDto {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主键id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "订单id")
|
||||||
|
private Integer orderId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备id")
|
||||||
|
private Integer maId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "收货时间")
|
||||||
|
private String reliefStartTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "租赁结束时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
|
private String reliefEndTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -86,6 +86,8 @@ public class OrderInfoDto {
|
||||||
|
|
||||||
private List<OrderDetailDto> detailsList;
|
private List<OrderDetailDto> detailsList;
|
||||||
|
|
||||||
|
private List<OrderDetailCostReliefDto> reliefList;
|
||||||
|
|
||||||
@ApiModelProperty(value = "承租方公司名称")
|
@ApiModelProperty(value = "承租方公司名称")
|
||||||
private String companyName;
|
private String companyName;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.bonus.material.order.mapper;
|
||||||
|
|
||||||
import com.bonus.material.device.domain.DevInfo;
|
import com.bonus.material.device.domain.DevInfo;
|
||||||
import com.bonus.material.lease.domain.LeaseRepairRecord;
|
import com.bonus.material.lease.domain.LeaseRepairRecord;
|
||||||
|
import com.bonus.material.order.domain.OrderDetailCostReliefDto;
|
||||||
import com.bonus.material.order.domain.OrderDetailDto;
|
import com.bonus.material.order.domain.OrderDetailDto;
|
||||||
import com.bonus.material.order.domain.OrderInfoDto;
|
import com.bonus.material.order.domain.OrderInfoDto;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
@ -38,4 +39,8 @@ public interface OrderMapper {
|
||||||
List<OrderDetailDto> getOrderDetailsByOrderId(Integer orderId);
|
List<OrderDetailDto> getOrderDetailsByOrderId(Integer orderId);
|
||||||
|
|
||||||
int updateOrder(LeaseRepairRecord leaseRepairRecord);
|
int updateOrder(LeaseRepairRecord leaseRepairRecord);
|
||||||
|
|
||||||
|
int deleteCostReliefs(@Param("orderId") Integer orderId);
|
||||||
|
|
||||||
|
int insertCostReliefs(@Param("list") List<OrderDetailCostReliefDto> reliefList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.material.order.service;
|
package com.bonus.material.order.service;
|
||||||
|
|
||||||
|
import com.bonus.material.order.domain.OrderDetailCostReliefDto;
|
||||||
import com.bonus.material.order.domain.OrderDetailDto;
|
import com.bonus.material.order.domain.OrderDetailDto;
|
||||||
import com.bonus.material.order.domain.OrderInfoDto;
|
import com.bonus.material.order.domain.OrderInfoDto;
|
||||||
|
|
||||||
|
|
@ -16,4 +17,6 @@ public interface OrderService {
|
||||||
List<OrderInfoDto> getOrderDetails(OrderInfoDto orderInfoDto) throws Exception;
|
List<OrderInfoDto> getOrderDetails(OrderInfoDto orderInfoDto) throws Exception;
|
||||||
|
|
||||||
OrderInfoDto getOrderDetailsById(OrderDetailDto dto) throws Exception;
|
OrderInfoDto getOrderDetailsById(OrderDetailDto dto) throws Exception;
|
||||||
|
|
||||||
|
Integer submitCostRelief(OrderInfoDto orderInfoDto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,14 @@ import com.bonus.common.biz.enums.MaStatusEnum;
|
||||||
import com.bonus.common.security.utils.SecurityUtils;
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.material.device.domain.DevInfo;
|
import com.bonus.material.device.domain.DevInfo;
|
||||||
import com.bonus.material.lease.mapper.LeaseRepairRecordMapper;
|
import com.bonus.material.lease.mapper.LeaseRepairRecordMapper;
|
||||||
|
import com.bonus.material.order.domain.OrderDetailCostReliefDto;
|
||||||
import com.bonus.material.order.domain.OrderDetailDto;
|
import com.bonus.material.order.domain.OrderDetailDto;
|
||||||
import com.bonus.material.order.domain.OrderInfoDto;
|
import com.bonus.material.order.domain.OrderInfoDto;
|
||||||
import com.bonus.material.order.mapper.OrderMapper;
|
import com.bonus.material.order.mapper.OrderMapper;
|
||||||
import com.bonus.material.order.service.OrderService;
|
import com.bonus.material.order.service.OrderService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
@ -130,4 +132,14 @@ public class OrderServiceImpl implements OrderService {
|
||||||
orderInfoDto.setDetailsList(list);
|
orderInfoDto.setDetailsList(list);
|
||||||
return orderInfoDto;
|
return orderInfoDto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer submitCostRelief(OrderInfoDto orderInfoDto) {
|
||||||
|
List<OrderDetailCostReliefDto> list = orderInfoDto.getReliefList();
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
orderMapper.deleteCostReliefs(list.get(0).getOrderId());
|
||||||
|
return orderMapper.insertCostReliefs(orderInfoDto.getReliefList());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -266,4 +266,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
mt.del_flag = 0 and hh.order_id = #{orderId}
|
mt.del_flag = 0 and hh.order_id = #{orderId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<delete id="deleteCostReliefs">
|
||||||
|
delete from ma_order_details_relief
|
||||||
|
where order_id = #{orderId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<insert id="insertCostReliefs">
|
||||||
|
insert into ma_order_details_relief(order_id, ma_id, relief_begin_time, relief_end_time, create_time)
|
||||||
|
values
|
||||||
|
<foreach collection="list" item="item" index="index" separator=",">
|
||||||
|
(
|
||||||
|
#{item.orderId},
|
||||||
|
#{item.maId},
|
||||||
|
#{item.reliefStartTime},
|
||||||
|
#{item.reliefEndTime},
|
||||||
|
now()
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue