70 changed files with 1221 additions and 416 deletions
@ -0,0 +1,22 @@ |
|||
package cc.hiver.core.vo.thorui; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@ApiModel("tui-select模型") |
|||
@Data |
|||
@NoArgsConstructor |
|||
public class SelectVo { |
|||
public SelectVo(String text, String value) { |
|||
this.text = text; |
|||
this.value = value; |
|||
} |
|||
|
|||
@ApiModelProperty("选项键名") |
|||
private String text; |
|||
|
|||
@ApiModelProperty("选项键值") |
|||
private String value; |
|||
} |
|||
@ -0,0 +1,58 @@ |
|||
package cc.hiver.core.vo.thorui; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonInclude; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
import java.util.List; |
|||
|
|||
@ApiModel("tui-tree-view模型") |
|||
@Data |
|||
@NoArgsConstructor |
|||
public class TreeVo { |
|||
public TreeVo(String text, String value) { |
|||
this.text = text; |
|||
this.value = value; |
|||
} |
|||
|
|||
public TreeVo(String text, String value, String src) { |
|||
this.text = text; |
|||
this.value = value; |
|||
} |
|||
|
|||
public TreeVo(String text, String value, List<TreeVo> children) { |
|||
this.text = text; |
|||
this.value = value; |
|||
} |
|||
|
|||
public TreeVo(String text, String value, String src, List<TreeVo> children) { |
|||
this.text = text; |
|||
this.value = value; |
|||
this.children = children; |
|||
} |
|||
|
|||
public TreeVo(String text, String value, String src, Boolean collapsed, List<TreeVo> children) { |
|||
this.text = text; |
|||
this.value = value; |
|||
this.collapsed = collapsed; |
|||
this.children = children; |
|||
} |
|||
|
|||
@ApiModelProperty("键名") |
|||
private String text; |
|||
|
|||
@ApiModelProperty("键值") |
|||
private String value; |
|||
|
|||
@ApiModelProperty(value = "图片") |
|||
private String src; |
|||
|
|||
@ApiModelProperty(value = "是否打开") |
|||
private Boolean collapsed = false; |
|||
|
|||
@ApiModelProperty(value = "子项") |
|||
@JsonInclude(value = JsonInclude.Include.NON_EMPTY) |
|||
private List<TreeVo> children; |
|||
} |
|||
@ -0,0 +1,185 @@ |
|||
package cc.hiver.mall.controller; |
|||
|
|||
import cc.hiver.core.common.constant.MallConstant; |
|||
import cc.hiver.core.common.exception.HiverException; |
|||
import cc.hiver.core.common.utils.PageUtil; |
|||
import cc.hiver.core.common.utils.ResultUtil; |
|||
import cc.hiver.core.common.utils.SecurityUtil; |
|||
import cc.hiver.core.common.vo.PageVo; |
|||
import cc.hiver.core.common.vo.Result; |
|||
import cc.hiver.core.entity.OrderXd; |
|||
import cc.hiver.core.service.OrderService; |
|||
import cc.hiver.mall.entity.CustomAddress; |
|||
import cc.hiver.mall.entity.GoodsBrand; |
|||
import cc.hiver.mall.entity.SalesOrder; |
|||
import cc.hiver.mall.entity.SalesOrderItem; |
|||
import cc.hiver.mall.pojo.dto.CartItemDTO; |
|||
import cc.hiver.mall.pojo.form.SalesOrderForm; |
|||
import cc.hiver.mall.pojo.query.SalesOrderQueryCriteria; |
|||
import cc.hiver.mall.pojo.vo.SalesOrderVo; |
|||
import cc.hiver.mall.service.CartService; |
|||
import cc.hiver.mall.service.CustomAddressService; |
|||
import cc.hiver.mall.service.SalesOrderItemService; |
|||
import cc.hiver.mall.service.SalesOrderService; |
|||
import cn.hutool.core.util.StrUtil; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.ibatis.annotations.Param; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.data.domain.Page; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
@Slf4j |
|||
@RestController |
|||
@Api(tags = "销售订单接口") |
|||
@RequestMapping(value = "/hiver/app/sales/") |
|||
@Transactional |
|||
public class SalesOrderController { |
|||
@Autowired |
|||
private CartService cartService; |
|||
|
|||
@Autowired |
|||
private SalesOrderService salesOrderService; |
|||
|
|||
@Autowired |
|||
private OrderService orderService; |
|||
|
|||
@Autowired |
|||
private CustomAddressService customAddressService; |
|||
|
|||
@Autowired |
|||
private SalesOrderItemService salesOrderItemService; |
|||
|
|||
@Autowired |
|||
private SecurityUtil securityUtil; |
|||
|
|||
@RequestMapping(value = "/create", method = RequestMethod.GET) |
|||
@ApiOperation(value = "创建订单") |
|||
public Result<SalesOrder> create(@Param("购买人") String buyUserId) { |
|||
if(StrUtil.isNotBlank(buyUserId)) { |
|||
// 处理中订单只能有一个
|
|||
SalesOrder salesOrder = salesOrderService.findByBuyUserIdAndUserIdAndStatus(securityUtil.getCurrUser().getId(), buyUserId, 0); |
|||
if (salesOrder != null) { |
|||
return new ResultUtil<SalesOrder>().setData(salesOrder); |
|||
} else { |
|||
SalesOrder newSalesOrder = new SalesOrder(); |
|||
newSalesOrder.setSn(MallConstant.ORDER_PREFIX + newSalesOrder.getId()); |
|||
newSalesOrder.setBuyUserId(buyUserId); |
|||
newSalesOrder.setUserId(securityUtil.getCurrUser().getId()); |
|||
CustomAddress customAddress = customAddressService.findById(buyUserId); |
|||
newSalesOrder.setConsigneeName(customAddress.getConsigneeName()); |
|||
salesOrderService.save(newSalesOrder); |
|||
return new ResultUtil<SalesOrder>().setData(newSalesOrder); |
|||
} |
|||
} else { |
|||
throw new HiverException(("请选择客户")); |
|||
} |
|||
} |
|||
|
|||
@RequestMapping(value = "/buy", method = RequestMethod.POST) |
|||
@ApiOperation(value = "下单操作") |
|||
@Transactional |
|||
public Result buy(@RequestBody SalesOrderForm salesOrderForm) { |
|||
SalesOrder salesOrder = salesOrderService.findByBuyUserIdAndUserIdAndStatus(salesOrderForm.getBuyUserID(), securityUtil.getCurrUser().getId(), 0); |
|||
if(salesOrder != null) { |
|||
String buyUserId = salesOrder.getBuyUserId(); |
|||
salesOrder.setConsigneeName(salesOrderForm.getBuyUserName()); |
|||
salesOrder.setConsigneeMobile(salesOrderForm.getConsigneeMobile()); |
|||
salesOrder.setConsigneeArea(salesOrderForm.getConsigneeArea()); |
|||
salesOrder.setAddress(salesOrderForm.getAddress()); |
|||
salesOrder.setStatus(1); |
|||
BigDecimal total = new BigDecimal(0); |
|||
Integer num = 0; |
|||
for(CartItemDTO item : salesOrderForm.getBuyGoods()) |
|||
{ |
|||
if(item.getChecked() && item.getCount() > 0) { |
|||
SalesOrderItem salesOrderItem = new SalesOrderItem(); |
|||
salesOrderItem.setSalesOrderId(salesOrder.getId()); |
|||
salesOrderItem.setSn(item.getSn()); |
|||
salesOrderItem.setName(item.getName()); |
|||
salesOrderItem.setPicUrl(item.getPicUrl()); |
|||
salesOrderItem.setGoodsId(item.getGoodsId()); |
|||
salesOrderItem.setGoodsName(item.getGoodsName()); |
|||
salesOrderItem.setPrice(item.getPrice()); |
|||
salesOrderItem.setWholesalePrice(item.getWholesalePrice()); |
|||
salesOrderItem.setPurchasePrice(item.getPurchasePrice()); |
|||
salesOrderItem.setStockId(item.getId()); |
|||
salesOrderItem.setCount(item.getCount()); |
|||
BigDecimal p = item.getPrice().multiply(new BigDecimal(item.getCount())); |
|||
total = total.add(p); |
|||
num += item.getCount(); |
|||
salesOrderItem.setTotalAmount(p); |
|||
salesOrderItemService.save(salesOrderItem); |
|||
} |
|||
} |
|||
salesOrder.setTotalAmount(total); |
|||
salesOrderService.update(salesOrder); |
|||
// 写入抢单表
|
|||
OrderXd order = new OrderXd(); |
|||
order.setOrderId(salesOrder.getSn()); |
|||
order.setOrderAddress(salesOrder.getConsigneeArea()); |
|||
order.setOrderStreet(salesOrder.getAddress()); |
|||
order.setOrderDescribe(""); |
|||
order.setOrderNum(num); |
|||
order.setOrderStatus(1); |
|||
order.setTimeout("0"); |
|||
order.setOrderBkge(0); |
|||
order.setMobile(salesOrder.getConsigneeMobile()); |
|||
order.setRegion(salesOrderForm.getRegion()); |
|||
orderService.save(order); |
|||
cartService.deleteCart(securityUtil.getCurrUser().getId(), buyUserId); |
|||
return ResultUtil.success(); |
|||
} else { |
|||
return ResultUtil.error("购物车信息不存在"); |
|||
} |
|||
} |
|||
|
|||
@RequestMapping(value = "/status", method = RequestMethod.POST) |
|||
@ApiOperation(value = "修改订单状态") |
|||
public Result updateStatus(String orderId, Integer status) { |
|||
SalesOrder salesOrder = salesOrderService.findById(orderId); |
|||
salesOrder.setStatus(status); |
|||
salesOrderService.update(salesOrder); |
|||
if(status == 9) { |
|||
// 9时撤销
|
|||
OrderXd orderXd = orderService.findByOrderId(salesOrder.getSn()); |
|||
orderXd.setOrderStatus(9); |
|||
orderService.update(orderXd); |
|||
} |
|||
return ResultUtil.success(); |
|||
} |
|||
|
|||
@RequestMapping(value = "/delByIds", method = RequestMethod.POST) |
|||
@ApiOperation(value = "批量通过ids删除") |
|||
public Result delByIds(@RequestParam String[] ids) { |
|||
for (String id : ids) { |
|||
SalesOrder salesOrder = salesOrderService.findById(id); |
|||
String buyUserId = salesOrder.getBuyUserId(); |
|||
salesOrderService.delete(id); |
|||
cartService.deleteCart(securityUtil.getCurrUser().getId(), buyUserId); |
|||
} |
|||
return ResultUtil.success("批量通过id删除数据成功"); |
|||
} |
|||
|
|||
@RequestMapping(value = "/getByCondition", method = RequestMethod.POST) |
|||
@ApiOperation(value = "根据条件获得分页") |
|||
public Result<Page<SalesOrder>> queryAll(SalesOrderQueryCriteria criteria, PageVo pageVo) { |
|||
Page<SalesOrder> users = salesOrderService.queryAll(criteria, PageUtil.initPage(pageVo)); |
|||
return new ResultUtil<Page<SalesOrder>>().setData(users); |
|||
} |
|||
|
|||
@RequestMapping(value = "/get/{id}", method = RequestMethod.GET) |
|||
@ApiOperation(value = "获得订单详细") |
|||
public Result<SalesOrderVo> get(@PathVariable String id) { |
|||
SalesOrderVo salesOrderVo = new SalesOrderVo(); |
|||
SalesOrder salesOrder = salesOrderService.findById(id); |
|||
salesOrderVo.setSalesOrder(salesOrder); |
|||
salesOrderVo.setSalesOrderItems(salesOrderItemService.findAllBySalesOrderId(id)); |
|||
salesOrderVo.setOrderXd(orderService.findByOrderId(salesOrder.getSn())); |
|||
return new ResultUtil<SalesOrderVo>().setData(salesOrderVo); |
|||
} |
|||
} |
|||
@ -0,0 +1,85 @@ |
|||
package cc.hiver.mall.controller; |
|||
|
|||
import cc.hiver.core.common.utils.PageUtil; |
|||
import cc.hiver.core.common.utils.ResultUtil; |
|||
import cc.hiver.core.common.utils.SecurityUtil; |
|||
import cc.hiver.core.common.vo.PageVo; |
|||
import cc.hiver.core.common.vo.Result; |
|||
import cc.hiver.core.entity.User; |
|||
import cc.hiver.mall.entity.Supplier; |
|||
import cc.hiver.mall.pojo.query.SupplierQueryCriteria; |
|||
import cc.hiver.mall.service.SupplierService; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.data.domain.Page; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import javax.persistence.EntityManager; |
|||
import javax.persistence.PersistenceContext; |
|||
|
|||
@Slf4j |
|||
@RestController |
|||
@Api(tags = "供应商接口") |
|||
@RequestMapping(value = "/hiver/app/supplier/") |
|||
@Transactional |
|||
public class SupplierControlller { |
|||
@Autowired |
|||
private SupplierService supplierService; |
|||
|
|||
@Autowired |
|||
private SecurityUtil securityUtil; |
|||
|
|||
@PersistenceContext |
|||
private EntityManager entityManager; |
|||
|
|||
@RequestMapping(value = "/getByCondition", method = RequestMethod.POST) |
|||
@ApiOperation(value = "根据条件获得分页") |
|||
public Result<Page<Supplier>> queryAll(SupplierQueryCriteria criteria, PageVo pageVo) { |
|||
Page<Supplier> users = supplierService.queryAll(criteria, PageUtil.initPage(pageVo)); |
|||
return new ResultUtil<Page<Supplier>>().setData(users); |
|||
} |
|||
|
|||
@RequestMapping(value = "/get/{id}", method = RequestMethod.GET) |
|||
@ApiOperation(value = "通过id获取") |
|||
public Result<Supplier> get(@PathVariable String id) { |
|||
Supplier data = supplierService.findById(id); |
|||
return new ResultUtil<Supplier>().setData(data); |
|||
} |
|||
|
|||
@RequestMapping(value = "/save", method = RequestMethod.POST) |
|||
@ApiOperation(value = "保存数据") |
|||
public Result<Supplier> save(Supplier entity) { |
|||
User u = securityUtil.getCurrUser(); |
|||
// 清除持久上下文环境 避免后面语句导致持久化
|
|||
entityManager.detach(u); |
|||
u.setPassword(null); |
|||
entity.setUserId(u.getId()); |
|||
Supplier address = supplierService.save(entity); |
|||
return new ResultUtil<Supplier>().setData(address); |
|||
} |
|||
|
|||
@RequestMapping(value = "/edit", method = RequestMethod.POST) |
|||
@ApiOperation(value = "更新数据") |
|||
public Result<Supplier> edit(Supplier entity) { |
|||
Supplier data = supplierService.findById(entity.getId()); |
|||
data.setConsigneeName(entity.getConsigneeName()); |
|||
data.setConsigneeArea(entity.getConsigneeArea()); |
|||
data.setConsigneeMobile(entity.getConsigneeMobile()); |
|||
data.setAddress(entity.getAddress()); |
|||
data.setZipCode(entity.getZipCode()); |
|||
Supplier address = supplierService.update(data); |
|||
return new ResultUtil<Supplier>().setData(address); |
|||
} |
|||
|
|||
@RequestMapping(value = "/delByIds", method = RequestMethod.POST) |
|||
@ApiOperation(value = "批量通过ids删除") |
|||
public Result delByIds(@RequestParam String[] ids) { |
|||
for (String id : ids) { |
|||
supplierService.delete(id); |
|||
} |
|||
return ResultUtil.success("批量通过id删除数据成功"); |
|||
} |
|||
} |
|||
@ -1,7 +0,0 @@ |
|||
package cc.hiver.mall.dao; |
|||
|
|||
import cc.hiver.core.base.HiverBaseDao; |
|||
import cc.hiver.mall.entity.Mall; |
|||
|
|||
public interface MallDao extends HiverBaseDao<Mall, String> { |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package cc.hiver.mall.dao; |
|||
|
|||
import cc.hiver.core.base.HiverBaseDao; |
|||
import cc.hiver.mall.entity.ShopUser; |
|||
|
|||
public interface ShopUserDao extends HiverBaseDao<ShopUser, String> { |
|||
void deleteAllByShopId(String shopId); |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
package cc.hiver.mall.dao; |
|||
|
|||
import cc.hiver.core.base.HiverBaseDao; |
|||
import cc.hiver.mall.entity.Supplier; |
|||
|
|||
public interface SupplierDao extends HiverBaseDao<Supplier, String> { |
|||
} |
|||
@ -1,8 +0,0 @@ |
|||
package cc.hiver.mall.dao; |
|||
|
|||
import cc.hiver.core.base.HiverBaseDao; |
|||
import cc.hiver.mall.entity.UserMall; |
|||
|
|||
public interface UserMallDao extends HiverBaseDao<UserMall, String> { |
|||
void deleteAllByMallId(String mallId); |
|||
} |
|||
@ -1,45 +0,0 @@ |
|||
package cc.hiver.mall.entity; |
|||
|
|||
import cc.hiver.core.base.HiverBaseMallEntity; |
|||
import cc.hiver.core.common.constant.CommonConstant; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.annotations.DynamicInsert; |
|||
import org.hibernate.annotations.DynamicUpdate; |
|||
|
|||
import javax.persistence.Column; |
|||
import javax.persistence.Entity; |
|||
import javax.persistence.Table; |
|||
import java.math.BigDecimal; |
|||
|
|||
@Data |
|||
@Entity |
|||
@DynamicInsert |
|||
@DynamicUpdate |
|||
@Table(name = "t_mall") |
|||
@TableName("t_mall") |
|||
@ApiModel(value = "商铺表") |
|||
public class Mall extends HiverBaseMallEntity { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@ApiModelProperty(value = "商铺名称") |
|||
private String name; |
|||
|
|||
@ApiModelProperty(value = "商铺简介") |
|||
private String description; |
|||
|
|||
@ApiModelProperty(value = "商铺图片") |
|||
private String picUrl; |
|||
|
|||
@ApiModelProperty(value = "排序值") |
|||
@Column(precision = 10, scale = 2) |
|||
private BigDecimal sortOrder; |
|||
|
|||
@ApiModelProperty(value = "是否启用 0启用 -1禁用") |
|||
private Integer status = CommonConstant.STATUS_NORMAL; |
|||
|
|||
@ApiModelProperty(value = "是否默认商铺") |
|||
private Integer defaulted; |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
package cc.hiver.mall.entity; |
|||
|
|||
import cc.hiver.core.base.HiverBaseEntity; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import org.hibernate.annotations.DynamicInsert; |
|||
import org.hibernate.annotations.DynamicUpdate; |
|||
|
|||
import javax.persistence.Entity; |
|||
import javax.persistence.Table; |
|||
|
|||
@Data |
|||
@Entity |
|||
@DynamicInsert |
|||
@DynamicUpdate |
|||
@Table(name = "t_supplier") |
|||
@TableName("t_supplier") |
|||
@ApiModel(value = "供应商表") |
|||
public class Supplier extends HiverBaseEntity { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@ApiModelProperty(value = "用户ID") |
|||
private String userId; |
|||
|
|||
@ApiModelProperty(value = "供应商姓名") |
|||
private String consigneeName; |
|||
|
|||
@ApiModelProperty(value = "供应商联系方式") |
|||
private String consigneeMobile; |
|||
|
|||
@ApiModelProperty(value = "供应商公司") |
|||
private String consigneeCompany; |
|||
|
|||
@ApiModelProperty(value = "供应商所属区域") |
|||
private String consigneeArea; |
|||
|
|||
@ApiModelProperty(value = "详细地址") |
|||
private String address; |
|||
|
|||
@ApiModelProperty(value = "邮编") |
|||
private String zipCode; |
|||
} |
|||
@ -1,31 +0,0 @@ |
|||
package cc.hiver.mall.entity; |
|||
|
|||
import cc.hiver.core.base.HiverBaseEntity; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.experimental.Accessors; |
|||
import org.hibernate.annotations.DynamicInsert; |
|||
import org.hibernate.annotations.DynamicUpdate; |
|||
|
|||
import javax.persistence.Entity; |
|||
import javax.persistence.Table; |
|||
|
|||
@Data |
|||
@Accessors(chain = true) |
|||
@Entity |
|||
@DynamicInsert |
|||
@DynamicUpdate |
|||
@Table(name = "t_user_mall") |
|||
@TableName("t_user_mall") |
|||
@ApiModel(value = "用户管理商铺表") |
|||
public class UserMall extends HiverBaseEntity { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
@ApiModelProperty(value = "用户id") |
|||
private String userId; |
|||
|
|||
@ApiModelProperty(value = "商铺id") |
|||
private String mallId; |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
package cc.hiver.mall.pojo.form; |
|||
|
|||
import cc.hiver.mall.pojo.dto.CartItemDTO; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotNull; |
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
|||
|
|||
@Data |
|||
@ApiModel("订单表单") |
|||
public class SalesOrderForm { |
|||
@ApiModelProperty("购买用户ID") |
|||
@NotNull |
|||
private String buyUserID; |
|||
|
|||
@ApiModelProperty("总金额") |
|||
private BigDecimal totalPrice; |
|||
|
|||
@ApiModelProperty("收货人") |
|||
private String buyUserName; |
|||
|
|||
@ApiModelProperty("联系方式") |
|||
private String consigneeMobile; |
|||
|
|||
@ApiModelProperty("所属地区") |
|||
private String consigneeArea; |
|||
|
|||
@ApiModelProperty("详细地址") |
|||
private String address; |
|||
|
|||
@ApiModelProperty("所属类型") |
|||
private String type; |
|||
|
|||
@ApiModelProperty("所属区域") |
|||
private String region; |
|||
|
|||
@ApiModelProperty("商品列表") |
|||
@NotNull |
|||
private List<CartItemDTO> buyGoods; |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package cc.hiver.mall.pojo.query; |
|||
|
|||
import cc.hiver.core.common.annotation.Query; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class SalesOrderQueryCriteria { |
|||
@Query |
|||
private String id; |
|||
|
|||
@Query |
|||
private String buyUserId; |
|||
|
|||
@Query |
|||
private String userId; |
|||
|
|||
@Query |
|||
private Integer status; |
|||
|
|||
@Query(blurry = "sn,consigneeName,consigneeMobile") |
|||
private String blurry; |
|||
} |
|||
@ -0,0 +1,18 @@ |
|||
package cc.hiver.mall.pojo.query; |
|||
|
|||
import cc.hiver.core.common.annotation.Query; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
public class SupplierQueryCriteria implements Serializable { |
|||
@Query |
|||
private String id; |
|||
|
|||
@Query |
|||
private String userId; |
|||
|
|||
@Query(blurry = "consigneeName,consigneeMobile,consigneeCompany") |
|||
private String blurry; |
|||
} |
|||
@ -0,0 +1,15 @@ |
|||
package cc.hiver.mall.pojo.vo; |
|||
|
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
@Data |
|||
@Accessors(chain = true) |
|||
public class QueryVo { |
|||
@ApiModelProperty(value = "商铺id") |
|||
private String shopId; |
|||
|
|||
@ApiModelProperty(value = "所属区域") |
|||
private String region; |
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
package cc.hiver.mall.pojo.vo; |
|||
|
|||
import cc.hiver.core.entity.OrderXd; |
|||
import cc.hiver.mall.entity.SalesOrder; |
|||
import cc.hiver.mall.entity.SalesOrderItem; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
import lombok.experimental.Accessors; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Data |
|||
@Accessors(chain = true) |
|||
public class SalesOrderVo { |
|||
@ApiModelProperty(value = "订单主表") |
|||
private SalesOrder salesOrder; |
|||
|
|||
@ApiModelProperty(value = "订单子表") |
|||
private List<SalesOrderItem> salesOrderItems; |
|||
|
|||
@ApiModelProperty(value = "抢单表") |
|||
private OrderXd orderXd; |
|||
} |
|||
@ -1,7 +0,0 @@ |
|||
package cc.hiver.mall.service; |
|||
|
|||
import cc.hiver.core.base.HiverBaseService; |
|||
import cc.hiver.mall.entity.Mall; |
|||
|
|||
public interface MallService extends HiverBaseService<Mall, String> { |
|||
} |
|||
@ -0,0 +1,8 @@ |
|||
package cc.hiver.mall.service; |
|||
|
|||
import cc.hiver.core.base.HiverBaseService; |
|||
import cc.hiver.mall.entity.ShopUser; |
|||
|
|||
public interface ShopUserService extends HiverBaseService<ShopUser, String> { |
|||
void deleteAllByShopId(String shopId); |
|||
} |
|||
@ -0,0 +1,11 @@ |
|||
package cc.hiver.mall.service; |
|||
|
|||
import cc.hiver.core.base.HiverBaseService; |
|||
import cc.hiver.mall.entity.Supplier; |
|||
import cc.hiver.mall.pojo.query.SupplierQueryCriteria; |
|||
import org.springframework.data.domain.Page; |
|||
import org.springframework.data.domain.Pageable; |
|||
|
|||
public interface SupplierService extends HiverBaseService<Supplier, String> { |
|||
Page<Supplier> queryAll(SupplierQueryCriteria criteria, Pageable pageable); |
|||
} |
|||
@ -1,8 +0,0 @@ |
|||
package cc.hiver.mall.service; |
|||
|
|||
import cc.hiver.core.base.HiverBaseService; |
|||
import cc.hiver.mall.entity.UserMall; |
|||
|
|||
public interface UserMallService extends HiverBaseService<UserMall, String> { |
|||
void deleteAllByMallId(String mallId); |
|||
} |
|||
@ -1,17 +1,34 @@ |
|||
package cc.hiver.mall.service.mybatis; |
|||
|
|||
import cc.hiver.mall.entity.Mall; |
|||
import cc.hiver.app.entity.Shop; |
|||
import cc.hiver.core.vo.UserVo; |
|||
import com.baomidou.mybatisplus.extension.service.IService; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface IMallService extends IService<Mall> { |
|||
public interface IMallService extends IService<Shop> { |
|||
/** |
|||
* 通过用户id获取 |
|||
* |
|||
* @param userId |
|||
* @return |
|||
*/ |
|||
List<Mall> findByUserId(@Param("userId") String userId); |
|||
List<Shop> findByUserId(@Param("userId") String userId); |
|||
|
|||
/** |
|||
* 通过商铺获得店员列表 |
|||
* |
|||
* @param shopId |
|||
* @return |
|||
*/ |
|||
List<UserVo> findByShopId(@Param("shopId") String shopId); |
|||
|
|||
/** |
|||
* 更新其他默认状态 |
|||
* |
|||
* @param shopId |
|||
* @param userId |
|||
*/ |
|||
void updateOtherShopDefaulted(@Param("shopId") String shopId, @Param("userId") String userId); |
|||
} |
|||
|
|||
@ -1,23 +0,0 @@ |
|||
package cc.hiver.mall.serviceimpl; |
|||
|
|||
import cc.hiver.core.base.HiverBaseDao; |
|||
import cc.hiver.mall.dao.MallDao; |
|||
import cc.hiver.mall.entity.Mall; |
|||
import cc.hiver.mall.service.MallService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
@Transactional |
|||
public class MallServiceImpl implements MallService { |
|||
@Autowired |
|||
private MallDao mallDao; |
|||
|
|||
@Override |
|||
public HiverBaseDao<Mall, String> getRepository() { |
|||
return mallDao; |
|||
} |
|||
} |
|||
@ -0,0 +1,28 @@ |
|||
package cc.hiver.mall.serviceimpl; |
|||
|
|||
import cc.hiver.core.base.HiverBaseDao; |
|||
import cc.hiver.mall.dao.ShopUserDao; |
|||
import cc.hiver.mall.entity.ShopUser; |
|||
import cc.hiver.mall.service.ShopUserService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
@Transactional |
|||
public class ShopUserServiceImpl implements ShopUserService { |
|||
@Autowired |
|||
private ShopUserDao shopUserDao; |
|||
|
|||
@Override |
|||
public HiverBaseDao<ShopUser, String> getRepository() { |
|||
return shopUserDao; |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAllByShopId(String shopId) { |
|||
shopUserDao.deleteAllByShopId(shopId); |
|||
} |
|||
} |
|||
@ -0,0 +1,33 @@ |
|||
package cc.hiver.mall.serviceimpl; |
|||
|
|||
import cc.hiver.core.base.HiverBaseDao; |
|||
import cc.hiver.core.common.utils.QueryHelp; |
|||
import cc.hiver.mall.dao.SupplierDao; |
|||
import cc.hiver.mall.entity.Supplier; |
|||
import cc.hiver.mall.pojo.query.SupplierQueryCriteria; |
|||
import cc.hiver.mall.service.SupplierService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.data.domain.Page; |
|||
import org.springframework.data.domain.Pageable; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
@Transactional |
|||
public class SupplierServiceImpl implements SupplierService { |
|||
@Autowired |
|||
private SupplierDao supplierDao; |
|||
|
|||
@Override |
|||
public HiverBaseDao<Supplier, String> getRepository() { |
|||
return supplierDao; |
|||
} |
|||
|
|||
@Override |
|||
public Page<Supplier> queryAll(SupplierQueryCriteria criteria, Pageable pageable) { |
|||
Page<Supplier> list = supplierDao.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root, criteria, criteriaBuilder), pageable); |
|||
return list; |
|||
} |
|||
} |
|||
@ -1,28 +0,0 @@ |
|||
package cc.hiver.mall.serviceimpl; |
|||
|
|||
import cc.hiver.core.base.HiverBaseDao; |
|||
import cc.hiver.mall.dao.UserMallDao; |
|||
import cc.hiver.mall.entity.UserMall; |
|||
import cc.hiver.mall.service.UserMallService; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
@Slf4j |
|||
@Service |
|||
@Transactional |
|||
public class UserMallServiceImpl implements UserMallService { |
|||
@Autowired |
|||
private UserMallDao userMallDao; |
|||
|
|||
@Override |
|||
public HiverBaseDao<UserMall, String> getRepository() { |
|||
return userMallDao; |
|||
} |
|||
|
|||
@Override |
|||
public void deleteAllByMallId(String mallId) { |
|||
userMallDao.deleteAllByMallId(mallId); |
|||
} |
|||
} |
|||
@ -1,11 +1,23 @@ |
|||
<?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="cc.hiver.mall.dao.mapper.MallMapper"> |
|||
<select id="findByUserId" resultType="cc.hiver.mall.entity.Mall"> |
|||
<select id="findByUserId" resultType="cc.hiver.app.entity.Shop"> |
|||
SELECT DISTINCT m.* |
|||
FROM t_mall m |
|||
LEFT JOIN t_user_mall um ON m.id = um.mall_id |
|||
FROM t_shop m |
|||
LEFT JOIN t_shop_user um ON m.id = um.shop_id |
|||
WHERE um.user_id = #{userId} AND m.status = 0 |
|||
ORDER BY m.sort_order ASC |
|||
</select> |
|||
|
|||
<select id="findByShopId" resultType="cc.hiver.core.vo.UserVo"> |
|||
SELECT DISTINCT m.id, m.username, m.nickname |
|||
FROM t_user m |
|||
LEFT JOIN t_shop_user um ON m.id = um.user_id |
|||
WHERE um.shop_id = #{shopId} AND m.status = 0 |
|||
ORDER BY m.id ASC |
|||
</select> |
|||
|
|||
<delete id="updateOtherShopDefaulted" parameterType="java.lang.String"> |
|||
UPDATE t_shop SET defaulted = 0 WHERE user_id = #{userId} and shop_id != #{shopId}; |
|||
</delete> |
|||
</mapper> |
|||
Loading…
Reference in new issue