订单详情
This commit is contained in:
parent
a5ea99916c
commit
1a9ac5d66e
|
|
@ -1,6 +1,9 @@
|
|||
package com.ruoyi.business.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
|
@ -93,7 +96,7 @@ public class BizOrderController extends BaseController
|
|||
* 修改订单
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") Long id, ModelMap mmap)
|
||||
public String edit(@PathVariable(value = "id", required = true) Long id, ModelMap mmap)
|
||||
{
|
||||
BizOrder bizOrder = bizOrderService.selectBizOrderById(id);
|
||||
mmap.put("bizOrder", bizOrder);
|
||||
|
|
@ -112,6 +115,39 @@ public class BizOrderController extends BaseController
|
|||
return toAjax(bizOrderService.updateBizOrder(bizOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单发货
|
||||
*/
|
||||
@RequiresPermissions("business:order:edit")
|
||||
@Log(title = "订单", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/deliver")
|
||||
@ResponseBody
|
||||
public AjaxResult editDeliver(Long orderID)
|
||||
{
|
||||
return toAjax(bizOrderService.deliverBizOrder(orderID));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单修改地址/备注
|
||||
*/
|
||||
@RequiresPermissions("business:order:edit")
|
||||
@Log(title = "订单", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/updateAddressOrRemark")
|
||||
@ResponseBody
|
||||
public AjaxResult updateAddress(Long orderID, String content, Integer type)
|
||||
{
|
||||
BizOrder bizOrder = bizOrderService.selectBizOrderById(orderID);
|
||||
if (bizOrder == null) return toAjax(0);
|
||||
if (type == 0) {
|
||||
bizOrder.setAddressDetail(content);
|
||||
} else {
|
||||
bizOrder.setRemark(content);
|
||||
}
|
||||
bizOrder.setUpdateBy(ShiroUtils.getLoginName());
|
||||
bizOrder.setUpdateTime(new Date());
|
||||
return toAjax(bizOrderService.updateBizOrder(bizOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除订单
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,193 @@
|
|||
package com.ruoyi.business.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;
|
||||
|
||||
/**
|
||||
* 会员收货地址对象 biz_member_address
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2020-09-11
|
||||
*/
|
||||
public class BizMemberAddress extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 会员地址ID */
|
||||
private Long id;
|
||||
|
||||
/** 会员ID */
|
||||
@Excel(name = "会员ID")
|
||||
private Long memberID;
|
||||
|
||||
/** 手机号码 */
|
||||
@Excel(name = "手机号码")
|
||||
private String mobile;
|
||||
|
||||
/** 收货人姓名 */
|
||||
@Excel(name = "收货人姓名")
|
||||
private String memberName;
|
||||
|
||||
/** 收货人地址 */
|
||||
@Excel(name = "收货人地址")
|
||||
private String address;
|
||||
|
||||
/** 省编码 */
|
||||
@Excel(name = "省编码")
|
||||
private String provinceCode;
|
||||
|
||||
/** 省名称 */
|
||||
@Excel(name = "省名称")
|
||||
private String provinceName;
|
||||
|
||||
/** 市编码 */
|
||||
@Excel(name = "市编码")
|
||||
private String cityCode;
|
||||
|
||||
/** 市名称 */
|
||||
@Excel(name = "市名称")
|
||||
private String cityName;
|
||||
|
||||
/** 区编码 */
|
||||
@Excel(name = "区编码")
|
||||
private String areaCode;
|
||||
|
||||
/** 区名称 */
|
||||
@Excel(name = "区名称")
|
||||
private String areaName;
|
||||
|
||||
/** 是否删除:0-否,1-是 */
|
||||
@Excel(name = "是否删除:0-否,1-是")
|
||||
private Integer isDelete;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setMobile(String mobile)
|
||||
{
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public Long getMemberID() {
|
||||
return memberID;
|
||||
}
|
||||
|
||||
public void setMemberID(Long memberID) {
|
||||
this.memberID = memberID;
|
||||
}
|
||||
|
||||
public String getMobile()
|
||||
{
|
||||
return mobile;
|
||||
}
|
||||
public void setMemberName(String memberName)
|
||||
{
|
||||
this.memberName = memberName;
|
||||
}
|
||||
|
||||
public String getMemberName()
|
||||
{
|
||||
return memberName;
|
||||
}
|
||||
public void setAddress(String address)
|
||||
{
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getAddress()
|
||||
{
|
||||
return address;
|
||||
}
|
||||
public void setProvinceCode(String provinceCode)
|
||||
{
|
||||
this.provinceCode = provinceCode;
|
||||
}
|
||||
|
||||
public String getProvinceCode()
|
||||
{
|
||||
return provinceCode;
|
||||
}
|
||||
public void setProvinceName(String provinceName)
|
||||
{
|
||||
this.provinceName = provinceName;
|
||||
}
|
||||
|
||||
public String getProvinceName()
|
||||
{
|
||||
return provinceName;
|
||||
}
|
||||
public void setCityCode(String cityCode)
|
||||
{
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public String getCityCode()
|
||||
{
|
||||
return cityCode;
|
||||
}
|
||||
public void setCityName(String cityName)
|
||||
{
|
||||
this.cityName = cityName;
|
||||
}
|
||||
|
||||
public String getCityName()
|
||||
{
|
||||
return cityName;
|
||||
}
|
||||
public void setAreaCode(String areaCode)
|
||||
{
|
||||
this.areaCode = areaCode;
|
||||
}
|
||||
|
||||
public String getAreaCode()
|
||||
{
|
||||
return areaCode;
|
||||
}
|
||||
public void setAreaName(String areaName)
|
||||
{
|
||||
this.areaName = areaName;
|
||||
}
|
||||
|
||||
public String getAreaName()
|
||||
{
|
||||
return areaName;
|
||||
}
|
||||
public void setIsDelete(Integer isDelete)
|
||||
{
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
public Integer getIsDelete()
|
||||
{
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("mobile", getMobile())
|
||||
.append("memberName", getMemberName())
|
||||
.append("address", getAddress())
|
||||
.append("provinceCode", getProvinceCode())
|
||||
.append("provinceName", getProvinceName())
|
||||
.append("cityCode", getCityCode())
|
||||
.append("cityName", getCityName())
|
||||
.append("areaCode", getAreaCode())
|
||||
.append("areaName", getAreaName())
|
||||
.append("isDelete", getIsDelete())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,12 @@ import com.ruoyi.common.core.domain.BaseEntity;
|
|||
public class BizOrder extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
//订单状态(0-待支付,1-已支付,2-已取消, 3-待收货, 4-已完成)
|
||||
public static final int STATUS_INITIAL = 0;
|
||||
public static final int STATUS_PAYED = 1;
|
||||
public static final int STATUS_CANCELED = 2;
|
||||
public static final int STATUS_DELIVERY = 3;
|
||||
public static final int STATUS_COMPLETED = 4;
|
||||
|
||||
/** 订单ID */
|
||||
private Long id;
|
||||
|
|
@ -38,14 +44,47 @@ public class BizOrder extends BaseEntity
|
|||
@Excel(name = "订单金额")
|
||||
private BigDecimal orderAmount;
|
||||
|
||||
/** 订单状态:0-待支付,1-已支付,2-已取消 */
|
||||
@Excel(name = "订单状态:0-待支付,1-已支付,2-已取消")
|
||||
/** 订单状态:0-待支付,1-已支付,2-已取消, 3-待收货, 4-已完成 */
|
||||
@Excel(name = "0-待支付,1-已支付,2-已取消, 3-待收货, 4-已完成")
|
||||
private Integer orderStatus;
|
||||
|
||||
/** 订单备注 */
|
||||
@Excel(name = "订单备注")
|
||||
private String remark;
|
||||
|
||||
/** 收货人详细地址 */
|
||||
@Excel(name = "收货人详细地址")
|
||||
private String addressDetail;
|
||||
|
||||
/** 收货人地址ID */
|
||||
@Excel(name = "收货人地址ID")
|
||||
private Long addressId;
|
||||
|
||||
/** 商品信息 */
|
||||
@Excel(name = "商品名称")
|
||||
private String productName;
|
||||
|
||||
@Excel(name = "商品总额")
|
||||
private String productAmount;
|
||||
|
||||
@Excel(name = "商品数量")
|
||||
private String productCount;
|
||||
|
||||
/** 收货人地址信息 */
|
||||
@Excel(name = "收货人姓名")
|
||||
private String addressName;
|
||||
|
||||
@Excel(name = "收货人手机")
|
||||
private String addressMobile;
|
||||
|
||||
@Excel(name = "收货人省份")
|
||||
private String addressProvince;
|
||||
|
||||
@Excel(name = "收货人城市")
|
||||
private String addressCity;
|
||||
|
||||
@Excel(name = "收货人区域")
|
||||
private String addressArea;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
|
|
@ -119,6 +158,86 @@ public class BizOrder extends BaseEntity
|
|||
return addressId;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getAddressDetail() {
|
||||
return addressDetail;
|
||||
}
|
||||
|
||||
public void setAddressDetail(String addressDetail) {
|
||||
this.addressDetail = addressDetail;
|
||||
}
|
||||
|
||||
public String getProductName() {
|
||||
return productName;
|
||||
}
|
||||
|
||||
public void setProductName(String productName) {
|
||||
this.productName = productName;
|
||||
}
|
||||
|
||||
public String getProductAmount() {
|
||||
return productAmount;
|
||||
}
|
||||
|
||||
public void setProductAmount(String productAmount) {
|
||||
this.productAmount = productAmount;
|
||||
}
|
||||
|
||||
public String getProductCount() {
|
||||
return productCount;
|
||||
}
|
||||
|
||||
public void setProductCount(String productCount) {
|
||||
this.productCount = productCount;
|
||||
}
|
||||
|
||||
public String getAddressName() {
|
||||
return addressName;
|
||||
}
|
||||
|
||||
public void setAddressName(String addressName) {
|
||||
this.addressName = addressName;
|
||||
}
|
||||
|
||||
public String getAddressMobile() {
|
||||
return addressMobile;
|
||||
}
|
||||
|
||||
public void setAddressMobile(String addressMobile) {
|
||||
this.addressMobile = addressMobile;
|
||||
}
|
||||
|
||||
public String getAddressProvince() {
|
||||
return addressProvince;
|
||||
}
|
||||
|
||||
public void setAddressProvince(String addressProvince) {
|
||||
this.addressProvince = addressProvince;
|
||||
}
|
||||
|
||||
public String getAddressCity() {
|
||||
return addressCity;
|
||||
}
|
||||
|
||||
public void setAddressCity(String addressCity) {
|
||||
this.addressCity = addressCity;
|
||||
}
|
||||
|
||||
public String getAddressArea() {
|
||||
return addressArea;
|
||||
}
|
||||
|
||||
public void setAddressArea(String addressArea) {
|
||||
this.addressArea = addressArea;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
|||
|
|
@ -43,6 +43,14 @@ public interface IBizOrderService
|
|||
*/
|
||||
public int updateBizOrder(BizOrder bizOrder);
|
||||
|
||||
/**
|
||||
* 订单发货
|
||||
*
|
||||
* @param orderID 订单ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deliverBizOrder(Long orderID);
|
||||
|
||||
/**
|
||||
* 批量删除订单
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
package com.ruoyi.business.service.impl;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.framework.util.ShiroUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.business.mapper.BizOrderMapper;
|
||||
|
|
@ -71,6 +73,28 @@ public class BizOrderServiceImpl implements IBizOrderService
|
|||
return bizOrderMapper.updateBizOrder(bizOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单发货
|
||||
*
|
||||
* @param orderID 订单ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deliverBizOrder(Long orderID)
|
||||
{
|
||||
BizOrder bizOrder = bizOrderMapper.selectBizOrderById(orderID);
|
||||
if (bizOrder == null) {
|
||||
return 0;
|
||||
}
|
||||
//校验订单状态
|
||||
if (bizOrder.getOrderStatus() != BizOrder.STATUS_PAYED) {
|
||||
return 0;
|
||||
}
|
||||
bizOrder.setOrderStatus(BizOrder.STATUS_DELIVERY);
|
||||
bizOrder.setUpdateBy(ShiroUtils.getLoginName());
|
||||
bizOrder.setUpdateTime(new Date());
|
||||
return bizOrderMapper.updateBizOrder(bizOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除订单对象
|
||||
*
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<result property="memberName" column="member_name" />
|
||||
<result property="orderAmount" column="order_amount" />
|
||||
<result property="orderStatus" column="order_status" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="addressDetail" column="address_detail" />
|
||||
<result property="addressId" column="address_id" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
|
|
@ -20,7 +22,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectBizOrderVo">
|
||||
select id, order_sn, member_id, mobile, member_name, order_amount, order_status, address_id, create_by, create_time, update_by, update_time from biz_order
|
||||
select a.id, order_sn, a.member_id, a.mobile, a.member_name, order_amount, order_status, remark, address_detail, address_id, a.create_by, a.create_time, a.update_by, a.update_time,
|
||||
b.mobile addressMobile, b.member_name addressName, b.province_name addressProvince, b.city_name addressCity, b.area_name addressArea
|
||||
from biz_order a
|
||||
left join biz_member_address b on a.member_id = b.member_id
|
||||
left join (select max(id), product_id, product_code productName, product_count productCount, product_amount productAmount from biz_order_detail group by product_id) c
|
||||
on a.id = c.product_id
|
||||
</sql>
|
||||
|
||||
<select id="selectBizOrderList" parameterType="BizOrder" resultMap="BizOrderResult">
|
||||
|
|
@ -44,6 +51,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="memberName != null and memberName != ''">member_name,</if>
|
||||
<if test="orderAmount != null">order_amount,</if>
|
||||
<if test="orderStatus != null">order_status,</if>
|
||||
<if test="addressDetail != null">address_detail,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="addressId != null">address_id,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
|
|
@ -57,6 +66,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="memberName != null and memberName != ''">#{memberName},</if>
|
||||
<if test="orderAmount != null">#{orderAmount},</if>
|
||||
<if test="orderStatus != null">#{orderStatus},</if>
|
||||
<if test="addressDetail != null">#{addressDetail},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="addressId != null">#{addressId},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
|
|
@ -74,6 +85,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="memberName != null and memberName != ''">member_name = #{memberName},</if>
|
||||
<if test="orderAmount != null">order_amount = #{orderAmount},</if>
|
||||
<if test="orderStatus != null">order_status = #{orderStatus},</if>
|
||||
<if test="addressDetail != null">address_detail = #{addressDetail},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="addressId != null">address_id = #{addressId},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<th:block th:include="include :: header('修改产品')" />
|
||||
<th:block th:include="include :: bootstrap-fileinput-css"/>
|
||||
</head>
|
||||
<body class="white-bg">111
|
||||
<body class="white-bg">
|
||||
<form class="form-horizontal m" id="form-product-edit" >
|
||||
<input name="productId" th:field="*{bizProduct.productId}" type="hidden">
|
||||
<input id="hiddenDetail" th:value="*{bizProduct.detailImages}" type="hidden">
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ CREATE TABLE `biz_member` (
|
|||
) COMMENT='会员表';
|
||||
|
||||
CREATE TABLE `biz_member_address` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '会员ID',
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '会员地址ID',
|
||||
`member_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '会员ID',
|
||||
`mobile` varchar(16) NOT NULL DEFAULT '0' COMMENT '手机号码',
|
||||
`member_name` varchar(32) NOT NULL DEFAULT '' COMMENT '收货人姓名',
|
||||
`address` varchar(64) NOT NULL DEFAULT '' COMMENT '收货人地址',
|
||||
|
|
@ -150,7 +151,9 @@ CREATE TABLE `biz_order` (
|
|||
`mobile` varchar(16) NOT NULL DEFAULT '0' COMMENT '手机号码',
|
||||
`member_name` varchar(32) NOT NULL DEFAULT '' COMMENT '用户姓名',
|
||||
`order_amount` decimal(12,2) NOT NULL DEFAULT 0.0 COMMENT '订单金额',
|
||||
`order_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '订单状态:0-待支付,1-已支付,2-已取消',
|
||||
`order_status` tinyint(4) NOT NULL DEFAULT 0 COMMENT '订单状态:0-待支付,1-已支付,2-已取消, 3-待收货, 4-已完成',
|
||||
`address_detail` varchar(64) NOT NULL DEFAULT '' COMMENT '收货地址',
|
||||
`remark` varchar(100) NOT NULL DEFAULT '' COMMENT '备注',
|
||||
`address_id` bigint(20) NOT NULL COMMENT '收货人地址ID',
|
||||
`create_by` varchar(64) DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
|
|
|
|||
Loading…
Reference in New Issue