营销官--获取订单列表--完成。

This commit is contained in:
haotianmingyue 2024-12-19 11:26:39 +08:00
parent 16d2965eab
commit e140c73ae1
22 changed files with 1151 additions and 49 deletions

View File

@ -123,24 +123,31 @@ public class SysAppUserController {
@GetMapping("/getUserCount")
public AjaxResult getUserCount(){
LocalDate now = LocalDate.now();
LocalDate startDate = now.minusDays(2);
LocalDate endDate = now.minusDays(1);
List<SeUserCountDto> seUserCount = sysUserStService.getUserCountByTime(startDate, endDate);
// // --------------------------------真实数据--------------------------------------
//
// LocalDate now = LocalDate.now();
// LocalDate startDate = now.minusDays(2);
// LocalDate endDate = now.minusDays(1);
// List<SeUserCountDto> seUserCount = sysUserStService.getUserCountByTime(startDate, endDate);
//
// SeUserCountDto seUserCountDto1 = seUserCount.get(0);
// SeUserCountDto seUserCountDto2 = seUserCount.get(1);
//
// // 当前用户总数
// Long userCount2 = seUserCountDto2.gettUser();
//
// // 前一天用户总数
// Long userCount1 = seUserCountDto1.gettUser();
//
// Long change = userCount2 - userCount1;
// AjaxResult ajax = new AjaxResult();
// ajax.put("userCount", userCount2);
// ajax.put("change", change);
// //---------------------------------真实数据end------------------------------------------
SeUserCountDto seUserCountDto1 = seUserCount.get(0);
SeUserCountDto seUserCountDto2 = seUserCount.get(1);
// 当前用户总数
Long userCount2 = seUserCountDto2.gettUser();
// 前一天用户总数
Long userCount1 = seUserCountDto1.gettUser();
Long change = userCount2 - userCount1;
AjaxResult ajax = new AjaxResult();
ajax.put("userCount", userCount2);
ajax.put("change", change);
ajax.put("userCount", 1234L);
ajax.put("change", 233L);
return ajax;

View File

@ -1,17 +1,20 @@
package com.ruoyi.web.controller.backstage;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.framework.web.domain.server.Sys;
import com.ruoyi.system.domain.dto.OrderIncomeDto;
import com.ruoyi.system.domain.dto.SysIncomeDto;
import com.ruoyi.system.domain.OrderInfo;
import com.ruoyi.system.domain.SysOrder;
import com.ruoyi.system.domain.dto.*;
import com.ruoyi.system.service.IDailySysService;
import com.ruoyi.system.service.IOrderInfoService;
import com.ruoyi.system.service.ISysOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.util.ArrayList;
@ -25,6 +28,12 @@ public class SysMarketController extends BaseController {
@Autowired
private IDailySysService dailySysService;
@Autowired
private ISysOrderService sysOrderService;
@Autowired
private IOrderInfoService orderInfoService;
@GetMapping("/getStIncome")
public AjaxResult getStIncome() {
@ -102,6 +111,56 @@ public class SysMarketController extends BaseController {
}
// 获取订单列表
@GetMapping("/getOrderList")
public TableDataInfo getOrderList(SysOrder sysOrder) {
// //------------------------------------真实接口----------------------------------------------
// LocalDate now = LocalDate.now();
// LocalDate startDate = now.minusDays(7);
// LocalDate endDate = now.minusDays(1);
// List<OrderIncomeDto> orderIncomeDtoList = dailySysService.getOrderIncome(startDate, endDate);
// return success(orderIncomeDtoList);
// //-----------------------------------真实接口end----------
List<OrderListDto> orderListDtoList = sysOrderService.getOrderListDto(sysOrder);
// 根据 order_info_id 查看订单所有的资源位
for(OrderListDto orderListDto: orderListDtoList){
Long orderInfoId = orderListDto.getOrderInfoId();
List<OrderInfoDto> orderInfoList = orderInfoService.getOrderInfoDtoList(orderInfoId);
for (OrderInfoDto orderInfoDto: orderInfoList){
orderInfoDto.setNickName(orderListDto.getNickName());
orderInfoDto.setPhoneNumber(orderListDto.getPhonenumber());
orderInfoDto.setSource(orderInfoDto.getCity()+orderInfoDto.getScenic()+orderInfoDto.getPart()+orderInfoDto.getCoordinate());
}
orderListDto.setOrderInfoList(orderInfoList);
}
return getDataTable(orderListDtoList);
}
//获取订单详情
@Log(title = "营销管理--查看订单详情", businessType = BusinessType.GET)
@PostMapping("/getOrderDetail/")
public AjaxResult getOrderDetail(@RequestBody GetOrderDetailDto getOrderDetailDto){
// sys_order 中的 order_id
Long orderId = getOrderDetailDto.getOrderId();
// order_info 中的 id
Long id = getOrderDetailDto.getId();
// OrderInfoDto orderInfoDto = orderInfoService.getOrderInfoDto(id);
return success();
}

View File

@ -98,10 +98,16 @@ public class SysSourceController extends BaseController {
// 价格
Map<String, String> price = GsonUtils.fromJson(sourceListDto.getPrice(), HashedMap.class);
// // 价格
// Map<String, String> price = GsonUtils.fromJson(sourceListDto.getPrice(), HashedMap.class);
//
// sourceListDto.setPriceJson(price);
// 新版价格
sourceListDto.setPriceList(GsonUtils.fromJson(sourceListDto.getPrice(), List.class));
sourceListDto.setPriceJson(price);
// 这里根据天数判断价格?? 还是直接返回每天的价格算了
@ -417,32 +423,34 @@ public class SysSourceController extends BaseController {
}
//---------------------------------------------------修改默认背景----------------------------------------------------
List<SetSourceImageDto> imageList = setSourceDto.getImageList();
for(SetSourceImageDto image : imageList){
System.out.println("图片前端数据: " + image.getCity()+image.getScenic()+image.getPart()+image.getWorkAddress());
SysScenicDefault sysScenicDefault = sysScenicDefaultService.getScenicDefaultByScenicAndPart(image.getScenic(), image.getPart());
System.out.println("默认设置id: " + sysScenicDefault.getId());
sysScenicDefault.setWorkAddress(image.getWorkAddress());
// 更新默认作品地址
sysScenicDefaultService.updateSysScenicDefault(sysScenicDefault);
// -------------------------修改没有出售的资源位的默认作品--还没写--------------------
// function
//--------------------------修改默认作品-----end---------------------------------
}
//---------------------------------------------------修改默认背景end----------------------------------------------------
// //---------------------------------------------------修改默认背景---因另写了修改图片接口而停用---------------------------------------------------
//
// List<SetSourceImageDto> imageList = setSourceDto.getImageList();
//
// for(SetSourceImageDto image : imageList){
// System.out.println("图片前端数据: " + image.getCity()+image.getScenic()+image.getPart()+image.getWorkAddress());
//
// SysScenicDefault sysScenicDefault = sysScenicDefaultService.getScenicDefaultByScenicAndPart(image.getScenic(), image.getPart());
//
// System.out.println("默认设置id: " + sysScenicDefault.getId());
//
// sysScenicDefault.setWorkAddress(image.getWorkAddress());
//
// // 更新默认作品地址
// sysScenicDefaultService.updateSysScenicDefault(sysScenicDefault);
//
//
// // -------------------------修改没有出售的资源位的默认作品--还没写--------------------
//
// // function
// //--------------------------修改默认作品-----end---------------------------------
//
// }
//
//
// //---------------------------------------------------修改默认背景end----------------------------------------------------
return success("修改成功");
@ -471,6 +479,7 @@ public class SysSourceController extends BaseController {
}
// 上传默认资源位图片--并更新sys_scenic_default默认的图片
// 修改默认被购买的资源位的默认图片---未完成
@Transactional
@Log(title = "产品管理--修改资源位默认图片", businessType = BusinessType.UPDATE)
@PostMapping("/changeSourceImage")
@ -513,6 +522,24 @@ public class SysSourceController extends BaseController {
// 更新数据库--图片地址
sysScenicDefaultService.updateSysScenicDefault(sysScenicDefault);
//-----------------------------修改默认被购买的资源位的默认图片----------------------------------------------
// 更新资源位默认图片---source_status=0
SysSource sysSource = new SysSource();
sysSource.setCity(city);
sysSource.setScenic(scenic);
sysSource.setPart(part);
sysSource.setWorkAddress(uploadFilePath);
// 根据city,scenic,part修改默认图片.
sysSourceService.updateSysSourceByCP(sysSource);
//------------------------修改没有被购买的资源位的默认图片end---------------------------------------------------------
// System.out.println("默认设置id: " + sysScenicDefault.getId());
// AjaxResult ajax = success();

View File

@ -0,0 +1,104 @@
package com.ruoyi.system.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.OrderInfo;
import com.ruoyi.system.service.IOrderInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 订单信息若一个订单存在购买多个资源位则添加多条数据Controller
*
* @author haotian
* @date 2024-12-17
*/
@RestController
@RequestMapping("/system/info")
public class OrderInfoController extends BaseController
{
@Autowired
private IOrderInfoService orderInfoService;
/**
* 查询订单信息若一个订单存在购买多个资源位则添加多条数据列表
*/
@PreAuthorize("@ss.hasPermi('system:info:list')")
@GetMapping("/list")
public TableDataInfo list(OrderInfo orderInfo)
{
startPage();
List<OrderInfo> list = orderInfoService.selectOrderInfoList(orderInfo);
return getDataTable(list);
}
/**
* 导出订单信息若一个订单存在购买多个资源位则添加多条数据列表
*/
@PreAuthorize("@ss.hasPermi('system:info:export')")
@Log(title = "订单信息,若一个订单存在购买多个资源位,则添加多条数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, OrderInfo orderInfo)
{
List<OrderInfo> list = orderInfoService.selectOrderInfoList(orderInfo);
ExcelUtil<OrderInfo> util = new ExcelUtil<OrderInfo>(OrderInfo.class);
util.exportExcel(response, list, "订单信息,若一个订单存在购买多个资源位,则添加多条数据数据");
}
/**
* 获取订单信息若一个订单存在购买多个资源位则添加多条数据详细信息
*/
@PreAuthorize("@ss.hasPermi('system:info:query')")
@GetMapping(value = "/{orderInfoId}")
public AjaxResult getInfo(@PathVariable("orderInfoId") Long orderInfoId)
{
return success(orderInfoService.selectOrderInfoByOrderInfoId(orderInfoId));
}
/**
* 新增订单信息若一个订单存在购买多个资源位则添加多条数据
*/
@PreAuthorize("@ss.hasPermi('system:info:add')")
@Log(title = "订单信息,若一个订单存在购买多个资源位,则添加多条数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody OrderInfo orderInfo)
{
return toAjax(orderInfoService.insertOrderInfo(orderInfo));
}
/**
* 修改订单信息若一个订单存在购买多个资源位则添加多条数据
*/
@PreAuthorize("@ss.hasPermi('system:info:edit')")
@Log(title = "订单信息,若一个订单存在购买多个资源位,则添加多条数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody OrderInfo orderInfo)
{
return toAjax(orderInfoService.updateOrderInfo(orderInfo));
}
/**
* 删除订单信息若一个订单存在购买多个资源位则添加多条数据
*/
@PreAuthorize("@ss.hasPermi('system:info:remove')")
@Log(title = "订单信息,若一个订单存在购买多个资源位,则添加多条数据", businessType = BusinessType.DELETE)
@DeleteMapping("/{orderInfoIds}")
public AjaxResult remove(@PathVariable Long[] orderInfoIds)
{
return toAjax(orderInfoService.deleteOrderInfoByOrderInfoIds(orderInfoIds));
}
}

View File

@ -0,0 +1,102 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.Date;
/**
* 订单信息若一个订单存在购买多个资源位则添加多条数据对象 order_info
*
* @author haotian
* @date 2024-12-17
*/
public class OrderInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 订单编号,主键,关联 */
private Long id;
private Long orderInfoId;
/** 资源位id */
@Excel(name = "资源位id")
private Long sourceId;
/** 作品id */
@Excel(name = "作品id")
private Long workId;
private String status;
private Date refundTime;
public void setId(Long id){
this.id = id;
}
public Long getId(){
return id;
}
public void setOrderInfoId(Long orderInfoId)
{
this.orderInfoId = orderInfoId;
}
public Long getOrderInfoId()
{
return orderInfoId;
}
public void setSourceId(Long sourceId)
{
this.sourceId = sourceId;
}
public Long getSourceId()
{
return sourceId;
}
public void setWorkId(Long workId)
{
this.workId = workId;
}
public Long getWorkId()
{
return workId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Date getRefundTime() {
return refundTime;
}
public void setRefundTime(Date refundTime) {
this.refundTime = refundTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("orderInfoId", getOrderInfoId())
.append("remark", getRemark())
.append("sourceId", getSourceId())
.append("workId", getWorkId())
.append("status", getStatus())
.toString();
}
}

View File

@ -54,6 +54,12 @@ public class SysOrder extends BaseEntity
// 订单详情
private String detail;
// 订单状态
private String status;
// 退款金额
private Long refund;
public void setOrderId(Long orderId)
{
this.orderId = orderId;
@ -141,6 +147,22 @@ public class SysOrder extends BaseEntity
this.detail = detail;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Long getRefund() {
return refund;
}
public void setRefund(Long refund) {
this.refund = refund;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -155,6 +177,8 @@ public class SysOrder extends BaseEntity
.append("money", getMoney())
.append("way", getWay())
.append("detail", getDetail())
.append("status", getStatus())
.append("detail", getDetail())
.toString();
}
}

View File

@ -0,0 +1,23 @@
package com.ruoyi.system.domain.dto;
public class GetOrderDetailDto {
private Long orderId;
private Long id;
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}

View File

@ -0,0 +1,175 @@
package com.ruoyi.system.domain.dto;
import java.util.Date;
public class OrderInfoDto {
private Long id;
private Long orderInfoId;
private Long userId;
private String nickName;
private String phoneNumber;
private Long sourceId;
private String workId;
private String workName;
private String workAddress;
private String workDetail;
private String city;
private String scenic;
private String part;
private String source;
private String status;
private String coordinate;
private Date refundTime;
public String getPart() {
return part;
}
public void setPart(String part) {
this.part = part;
}
public String getScenic() {
return scenic;
}
public void setScenic(String scenic) {
this.scenic = scenic;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getWorkDetail() {
return workDetail;
}
public void setWorkDetail(String workDetail) {
this.workDetail = workDetail;
}
public String getWorkAddress() {
return workAddress;
}
public void setWorkAddress(String workAddress) {
this.workAddress = workAddress;
}
public String getWorkName() {
return workName;
}
public void setWorkName(String workName) {
this.workName = workName;
}
public String getWorkId() {
return workId;
}
public void setWorkId(String workId) {
this.workId = workId;
}
public Long getSourceId() {
return sourceId;
}
public void setSourceId(Long sourceId) {
this.sourceId = sourceId;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getOrderInfoId() {
return orderInfoId;
}
public void setOrderInfoId(Long orderInfoId) {
this.orderInfoId = orderInfoId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getCoordinate() {
return coordinate;
}
public void setCoordinate(String coordinate) {
this.coordinate = coordinate;
}
public Date getRefundTime() {
return refundTime;
}
public void setRefundTime(Date refundTime) {
this.refundTime = refundTime;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
}

View File

@ -0,0 +1,148 @@
package com.ruoyi.system.domain.dto;
import java.util.Date;
import java.util.List;
public class OrderListDto {
private Long orderId;
private Long userId;
private String nickName;
private String phonenumber;
private Date createTime;
private Date startTime;
private Date endTime;
private Long orderInfoId;
private Long money;
private Long refund;
private String way;
private String orderDetail;
private String status;
private List<OrderInfoDto> orderInfoList;
public Long getOrderId() {
return orderId;
}
public void setOrderId(Long orderId) {
this.orderId = orderId;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Long getOrderInfoId() {
return orderInfoId;
}
public void setOrderInfoId(Long orderInfoId) {
this.orderInfoId = orderInfoId;
}
public Long getMoney() {
return money;
}
public void setMoney(Long money) {
this.money = money;
}
public Long getRefund() {
return refund;
}
public void setRefund(Long refund) {
this.refund = refund;
}
public String getWay() {
return way;
}
public void setWay(String way) {
this.way = way;
}
public String getOrderDetail() {
return orderDetail;
}
public void setOrderDetail(String orderDetail) {
this.orderDetail = orderDetail;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public List<OrderInfoDto> getOrderInfoList() {
return orderInfoList;
}
public void setOrderInfoList(List<OrderInfoDto> orderInfoList) {
this.orderInfoList = orderInfoList;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getPhonenumber() {
return phonenumber;
}
public void setPhonenumber(String phonenumber) {
this.phonenumber = phonenumber;
}
}

View File

@ -1,6 +1,7 @@
package com.ruoyi.system.domain.dto;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
public class SourceListDto {
@ -16,6 +17,8 @@ public class SourceListDto {
// json 话的价格
private Map<String, String> priceJson;
private List<Map<String, SetSourcePriceDto>> priceList;
private Long bBought;
private String sourceStatus;
@ -175,6 +178,14 @@ public class SourceListDto {
this.number = number;
}
public List<Map<String, SetSourcePriceDto>> getPriceList() {
return priceList;
}
public void setPriceList(List<Map<String, SetSourcePriceDto>> priceList) {
this.priceList = priceList;
}

View File

@ -0,0 +1,68 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.OrderInfo;
import com.ruoyi.system.domain.dto.OrderInfoDto;
/**
* 订单信息若一个订单存在购买多个资源位则添加多条数据Mapper接口
*
* @author haotian
* @date 2024-12-17
*/
public interface OrderInfoMapper
{
/**
* 查询订单信息若一个订单存在购买多个资源位则添加多条数据
*
* @param orderInfoId 订单信息若一个订单存在购买多个资源位则添加多条数据主键
* @return 订单信息若一个订单存在购买多个资源位则添加多条数据
*/
public OrderInfo selectOrderInfoByOrderInfoId(Long orderInfoId);
/**
* 查询订单信息若一个订单存在购买多个资源位则添加多条数据列表
*
* @param orderInfo 订单信息若一个订单存在购买多个资源位则添加多条数据
* @return 订单信息若一个订单存在购买多个资源位则添加多条数据集合
*/
public List<OrderInfo> selectOrderInfoList(OrderInfo orderInfo);
/**
* 新增订单信息若一个订单存在购买多个资源位则添加多条数据
*
* @param orderInfo 订单信息若一个订单存在购买多个资源位则添加多条数据
* @return 结果
*/
public int insertOrderInfo(OrderInfo orderInfo);
/**
* 修改订单信息若一个订单存在购买多个资源位则添加多条数据
*
* @param orderInfo 订单信息若一个订单存在购买多个资源位则添加多条数据
* @return 结果
*/
public int updateOrderInfo(OrderInfo orderInfo);
/**
* 删除订单信息若一个订单存在购买多个资源位则添加多条数据
*
* @param orderInfoId 订单信息若一个订单存在购买多个资源位则添加多条数据主键
* @return 结果
*/
public int deleteOrderInfoByOrderInfoId(Long orderInfoId);
/**
* 批量删除订单信息若一个订单存在购买多个资源位则添加多条数据
*
* @param orderInfoIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteOrderInfoByOrderInfoIds(Long[] orderInfoIds);
public List<OrderInfoDto> getOrderInfoDtoList(Long orderInfoId);
public OrderInfoDto getOrderInfoDto(Long id);
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.system.mapper;
import java.time.LocalDate;
import java.util.List;
import com.ruoyi.system.domain.SysOrder;
import com.ruoyi.system.domain.dto.OrderListDto;
import org.apache.ibatis.annotations.Param;
/**
@ -64,4 +65,6 @@ public interface SysOrderMapper
/*
* 检查订单时间是否合法*/
public int isTimeLegal(@Param("startTime")LocalDate startTime, @Param("endTime") LocalDate endTime, @Param("sourceId") Long sourceId);
public List<OrderListDto> getOrderListDto(SysOrder sysOrder);
}

View File

@ -73,4 +73,6 @@ public interface SysSourceMapper
public List<SourceListDto> getSysSourceList(SysSource sysSource);
public List<HotSourceDto> getHotSource();
public int updateSysSourceByCP(SysSource sysSource);
}

View File

@ -0,0 +1,68 @@
package com.ruoyi.system.service;
import java.util.List;
import com.ruoyi.system.domain.OrderInfo;
import com.ruoyi.system.domain.dto.OrderInfoDto;
/**
* 订单信息若一个订单存在购买多个资源位则添加多条数据Service接口
*
* @author haotian
* @date 2024-12-17
*/
public interface IOrderInfoService
{
/**
* 查询订单信息若一个订单存在购买多个资源位则添加多条数据
*
* @param orderInfoId 订单信息若一个订单存在购买多个资源位则添加多条数据主键
* @return 订单信息若一个订单存在购买多个资源位则添加多条数据
*/
public OrderInfo selectOrderInfoByOrderInfoId(Long orderInfoId);
/**
* 查询订单信息若一个订单存在购买多个资源位则添加多条数据列表
*
* @param orderInfo 订单信息若一个订单存在购买多个资源位则添加多条数据
* @return 订单信息若一个订单存在购买多个资源位则添加多条数据集合
*/
public List<OrderInfo> selectOrderInfoList(OrderInfo orderInfo);
/**
* 新增订单信息若一个订单存在购买多个资源位则添加多条数据
*
* @param orderInfo 订单信息若一个订单存在购买多个资源位则添加多条数据
* @return 结果
*/
public int insertOrderInfo(OrderInfo orderInfo);
/**
* 修改订单信息若一个订单存在购买多个资源位则添加多条数据
*
* @param orderInfo 订单信息若一个订单存在购买多个资源位则添加多条数据
* @return 结果
*/
public int updateOrderInfo(OrderInfo orderInfo);
/**
* 批量删除订单信息若一个订单存在购买多个资源位则添加多条数据
*
* @param orderInfoIds 需要删除的订单信息若一个订单存在购买多个资源位则添加多条数据主键集合
* @return 结果
*/
public int deleteOrderInfoByOrderInfoIds(Long[] orderInfoIds);
/**
* 删除订单信息若一个订单存在购买多个资源位则添加多条数据信息
*
* @param orderInfoId 订单信息若一个订单存在购买多个资源位则添加多条数据主键
* @return 结果
*/
public int deleteOrderInfoByOrderInfoId(Long orderInfoId);
/*返回属于order_info_id的所有资源位订单*/
public List<OrderInfoDto> getOrderInfoDtoList(Long orderInfoId);
/*返回定单详情*/
public OrderInfoDto getOrderInfoDto(Long id);
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.system.service;
import java.time.LocalDate;
import java.util.List;
import com.ruoyi.system.domain.SysOrder;
import com.ruoyi.system.domain.dto.OrderListDto;
/**
* 订单信息Service接口
@ -65,4 +66,10 @@ public interface ISysOrderService
* 查询订单是否合法
* */
public int isTimeLegal(LocalDate startTime, LocalDate endTime, Long sourceId);
/*
* 营销管理获取订单列表
* */
public List<OrderListDto> getOrderListDto(SysOrder sysOrder);
}

View File

@ -85,4 +85,6 @@ public interface ISysSourceService
* */
public List<HotSourceDto> getHotSource();
public int updateSysSourceByCP(SysSource sysSource);
}

View File

@ -0,0 +1,105 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.system.domain.dto.OrderInfoDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.OrderInfoMapper;
import com.ruoyi.system.domain.OrderInfo;
import com.ruoyi.system.service.IOrderInfoService;
/**
* 订单信息若一个订单存在购买多个资源位则添加多条数据Service业务层处理
*
* @author haotian
* @date 2024-12-17
*/
@Service
public class OrderInfoServiceImpl implements IOrderInfoService
{
@Autowired
private OrderInfoMapper orderInfoMapper;
/**
* 查询订单信息若一个订单存在购买多个资源位则添加多条数据
*
* @param orderInfoId 订单信息若一个订单存在购买多个资源位则添加多条数据主键
* @return 订单信息若一个订单存在购买多个资源位则添加多条数据
*/
@Override
public OrderInfo selectOrderInfoByOrderInfoId(Long orderInfoId)
{
return orderInfoMapper.selectOrderInfoByOrderInfoId(orderInfoId);
}
/**
* 查询订单信息若一个订单存在购买多个资源位则添加多条数据列表
*
* @param orderInfo 订单信息若一个订单存在购买多个资源位则添加多条数据
* @return 订单信息若一个订单存在购买多个资源位则添加多条数据
*/
@Override
public List<OrderInfo> selectOrderInfoList(OrderInfo orderInfo)
{
return orderInfoMapper.selectOrderInfoList(orderInfo);
}
/**
* 新增订单信息若一个订单存在购买多个资源位则添加多条数据
*
* @param orderInfo 订单信息若一个订单存在购买多个资源位则添加多条数据
* @return 结果
*/
@Override
public int insertOrderInfo(OrderInfo orderInfo)
{
return orderInfoMapper.insertOrderInfo(orderInfo);
}
/**
* 修改订单信息若一个订单存在购买多个资源位则添加多条数据
*
* @param orderInfo 订单信息若一个订单存在购买多个资源位则添加多条数据
* @return 结果
*/
@Override
public int updateOrderInfo(OrderInfo orderInfo)
{
return orderInfoMapper.updateOrderInfo(orderInfo);
}
/**
* 批量删除订单信息若一个订单存在购买多个资源位则添加多条数据
*
* @param orderInfoIds 需要删除的订单信息若一个订单存在购买多个资源位则添加多条数据主键
* @return 结果
*/
@Override
public int deleteOrderInfoByOrderInfoIds(Long[] orderInfoIds)
{
return orderInfoMapper.deleteOrderInfoByOrderInfoIds(orderInfoIds);
}
/**
* 删除订单信息若一个订单存在购买多个资源位则添加多条数据信息
*
* @param orderInfoId 订单信息若一个订单存在购买多个资源位则添加多条数据主键
* @return 结果
*/
@Override
public int deleteOrderInfoByOrderInfoId(Long orderInfoId)
{
return orderInfoMapper.deleteOrderInfoByOrderInfoId(orderInfoId);
}
@Override
public List<OrderInfoDto> getOrderInfoDtoList(Long orderInfoId){
return orderInfoMapper.getOrderInfoDtoList(orderInfoId);
}
@Override
public OrderInfoDto getOrderInfoDto(Long id){
return orderInfoMapper.getOrderInfoDto(id);
}
}

View File

@ -3,6 +3,7 @@ package com.ruoyi.system.service.impl;
import java.time.LocalDate;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.dto.OrderListDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysOrderMapper;
@ -98,4 +99,9 @@ public class SysOrderServiceImpl implements ISysOrderService
public int isTimeLegal(LocalDate startTime, LocalDate endTime, Long sourceId) {
return sysOrderMapper.isTimeLegal(startTime, endTime, sourceId);
}
@Override
public List<OrderListDto> getOrderListDto(SysOrder sysOrder){
return sysOrderMapper.getOrderListDto(sysOrder);
}
}

View File

@ -116,4 +116,9 @@ public class SysSourceServiceImpl implements ISysSourceService
public List<HotSourceDto> getHotSource(){
return sysSourceMapper.getHotSource();
};
@Override
public int updateSysSourceByCP(SysSource sysSource){
return sysSourceMapper.updateSysSourceByCP(sysSource);
}
}

View File

@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.OrderInfoMapper">
<resultMap type="OrderInfo" id="OrderInfoResult">
<result property="id" column="id"/>
<result property="orderInfoId" column="order_info_id" />
<result property="remark" column="remark" />
<result property="sourceId" column="source_id" />
<result property="workId" column="work_id" />
<result property="status" column="status"/>
<result property="refundTime" column="refund_time" />
</resultMap>
<resultMap id="OrderInfoDtoResult" type="OrderInfoDto">
<result property="orderInfoId" column="order_info_id"/>
<result property="sourceId" column="source_id"/>
<result property="workId" column="work_id"/>
<result property="status" column="status" />
<result property="city" column="city"/>
<result property="scenic" column="scenic"/>
<result property="part" column="part" />
<result property="workDetail" column="detail"/>
<result property="workName" column="work_name"/>
<result property="workAddress" column="work_address"/>
<result property="userId" column="user_id" />
<result property="coordinate" column="coordinate" />
<result property="refundTime" column="refund_time"/>
<result property="id" column="id"/>
<result property="nickName" column="nick_name"/>
</resultMap>
<sql id="selectOrderInfoVo">
select order_info_id, remark, source_id, work_id from order_info
</sql>
<select id="selectOrderInfoList" parameterType="OrderInfo" resultMap="OrderInfoResult">
<include refid="selectOrderInfoVo"/>
<where>
<if test="sourceId != null "> and source_id = #{sourceId}</if>
<if test="workId != null "> and work_id = #{workId}</if>
<if test="status != null "> and status = #{status}</if>
</where>
</select>
<select id="selectOrderInfoByOrderInfoId" parameterType="Long" resultMap="OrderInfoResult">
<include refid="selectOrderInfoVo"/>
where order_info_id = #{orderInfoId}
</select>
<select id="getOrderInfoDtoList" resultMap="OrderInfoDtoResult" >
select o.order_info_id, o.source_id, o.work_id, s.city, s.scenic, s.part,w.work_name ,w.detail, w.work_address, o.status, w.user_id, s.coordinate, o.refund_time, o.id
from order_info o
left join sys_source s on o.source_id = s.source_id
left join user_work w on o.work_id = w.work_id
where o.order_info_id = #{orderInfoId}
</select>
<insert id="insertOrderInfo" parameterType="OrderInfo">
insert into order_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="orderInfoId != null">order_info_id,</if>
<if test="remark != null">remark,</if>
<if test="sourceId != null">source_id,</if>
<if test="workId != null">work_id,</if>
<if test="id != null">id,</if>
<if test="status != null">status,</if>
<if test="refundTime != null">refund_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderInfoId != null">#{orderInfoId},</if>
<if test="remark != null">#{remark},</if>
<if test="sourceId != null">#{sourceId},</if>
<if test="workId != null">#{workId},</if>
<if test="id != null">#{id},</if>
<if test="status != null">#{status},</if>
<if test="refundTime != null">#{refundTime},</if>
</trim>
</insert>
<update id="updateOrderInfo" parameterType="OrderInfo">
update order_info
<trim prefix="SET" suffixOverrides=",">
<if test="remark != null">remark = #{remark},</if>
<if test="sourceId != null">source_id = #{sourceId},</if>
<if test="workId != null">work_id = #{workId},</if>
<if test="id != null">id = #{id},</if>
<if test="status != null">status = #{status},</if>
<if test="refundTime != null">refund_time = #{refundTime},</if>
</trim>
where order_info_id = #{orderInfoId}
</update>
<delete id="deleteOrderInfoByOrderInfoId" parameterType="Long">
delete from order_info where order_info_id = #{orderInfoId}
</delete>
<delete id="deleteOrderInfoByOrderInfoIds" parameterType="Long">
delete from order_info where order_info_id in
<foreach item="orderInfoId" collection="array" open="(" separator="," close=")">
#{orderInfoId}
</foreach>
</delete>
</mapper>

View File

@ -16,6 +16,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="money" column="money" />
<result property="way" column="way" />
<result property="detail" column="detail" />
<result property="status" column="status" />
<result property="refund" column="refund"/>
</resultMap>
<resultMap id="OrderListDtoResult" type="OrderListDto">
<result property="orderId" column="order_id"/>
<result property="createTime" column="create_time"/>
<result property="startTime" column="start_time"/>
<result property="endTime" column="end_time"/>
<result property="orderInfoId" column="order_info_id"/>
<result property="money" column="money"/>
<result property="refund" column="refund"/>
<result property="way" column="way" />
<result property="orderDetail" column="detail"/>
<result property="status" column="status"/>
<result property="userId" column="user_id"/>
<result property="nickName" column="nick_name"/>
<result property="phonenumber" column="phonenumber"/>
<!-- <result property="id"-->
</resultMap>
<sql id="selectSysOrderVo">
@ -34,6 +55,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="money != null "> and money = #{money}</if>
<if test="way != null "> and way = #{way}</if>
<if test="detail != null and detail != ''"> and detail like concat('%', #{detail}, '%')</if>
<if test="status != null "> and status = #{status}</if>
<if test="refund != null "> and refund = #{refund}</if>
</where>
</select>
@ -45,6 +68,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- select count(*) from sys_order where (start_time < #{startTime} and end_time > #{endTime}) and source_id = #{sourceId}-->
select count(*) from sys_order where source_id = #{sourceId} and #{endTime} >= sys_order.start_time and sys_order.end_time >= #{startTime}
</select>
<select id="getOrderListDto" resultMap="OrderListDtoResult">
select o.order_id, o.user_id, o.source_id, o.create_time, o.start_time, o.end_time, o.order_info_id, o.money, o.way, o.detail, o.status, o.refund, u.nick_name, u.phonenumber
from sys_order o
left join sys_user u
on o.user_id = u.user_id
<where>
<if test="status != null "> and o.status = #{status}</if>
<!-- <if test="createTime != null"></if>-->
<!-- and date between #{startDate} and #{endDate}-->
</where>
</select>
<insert id="insertSysOrder" parameterType="SysOrder" useGeneratedKeys="true" keyProperty="orderId">
insert into sys_order
@ -59,6 +95,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="money != null">money,</if>
<if test="way != null">way,</if>
<if test="detail != null">detail,</if>
<if test="status != null">status,</if>
<if test="refund != null">refund,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
@ -71,6 +109,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="money != null">#{money},</if>
<if test="way != null">#{way},</if>
<if test="detail != null">#{detail},</if>
<if test="status != null">#{status},</if>
<if test="refund != null">#{refund},</if>
</trim>
</insert>
@ -87,6 +127,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="money != null">money = #{money},</if>
<if test="way != null">way = #{way},</if>
<if test="detail != null">detail = #{detail},</if>
<if test="status != null">status = #{status},</if>
<if test="refund != null">refund = #{refund},</if>
</trim>
where order_id = #{orderId}
</update>

View File

@ -174,6 +174,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateDefaultSourcePrice">
update sys_source set price = #{price} where city = #{city} and scenic = #{scenic} and part = #{part}
</update>
<update id="updateSysSourceByCP" parameterType="SysSource">
update sys_source set work_address = #{workAddress} where city = #{city} and scenic = #{scenic} and part = #{part} and source_status = "0"
</update>
<delete id="deleteSysSourceBySourceId" parameterType="Long">
delete from sys_source where source_id = #{sourceId}