Browse Source

新增配送员佣金设定

master
wangfukang 2 months ago
parent
commit
5c81622bc9
  1. 20
      hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java
  2. 4
      hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java
  3. 14
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductCategoryController.java
  4. 32
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java
  5. 9
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopTakeawayController.java
  6. 65
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/WorkerRelaPriceController.java
  7. 18
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/WorkerRelaPriceMapper.java
  8. 18
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Product.java
  9. 16
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ProductGroupBuyPrice.java
  10. 53
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/WorkerRelaPrice.java
  11. 18
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductPageVO.java
  12. 18
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductVo.java
  13. 15
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/WorkerRelaPriceService.java
  14. 4
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductCategoryServiceImpl.java
  15. 35
      hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/WorkerRelaPriceServiceImpl.java
  16. 184
      hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml
  17. 48
      hiver-modules/hiver-mall/src/main/resources/mapper/WorkerRelaPriceMapper.xml

20
hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/AuthController.java

@ -48,6 +48,8 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
@ -420,6 +422,24 @@ public class AuthController {
shop.setShopLecard(registerShopVo.getShopLecard());
shop.setAliAccount(registerShopVo.getAliAccount());
shop.setAliName(registerShopVo.getAliName());
shop.setRegion(registerShopVo.getRegion());
shop.setRegionId(registerShopVo.getRegionId());
// 1. 获取当前日期 (LocalDate 只包含年月日,不包含时分秒)
final LocalDate today = LocalDate.now();
// 2. 定义格式器:yyyy-MM-dd
final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 3. 将当前日期格式化为字符串 (例如:2026-03-02)
final String formattedDate = today.format(formatter);
shop.setStartTime(formattedDate);
// 4. 计算加 10 年后的日期
LocalDate tenYearsLater = today.plusYears(10);
// 5. 将加 10 年后的日期格式化为字符串
String formattedFutureDate = tenYearsLater.format(formatter);
shop.setEndTime(formattedFutureDate);
// 店铺店铺名称,店铺地址,与用户(默认店主)的关联
// 设置注册用户为店主
shop.setShopOwnerId(user.getId());

4
hiver-modules/hiver-base/src/main/java/cc/hiver/base/controller/manage/UserController.java

@ -406,7 +406,7 @@ public class UserController {
return ResultUtil.error("该邮箱已绑定其他账户");
}
if (CharSequenceUtil.isNotBlank(u.getDepartmentId())) {
/*if (CharSequenceUtil.isNotBlank(u.getDepartmentId())) {
final Department d = departmentService.get(u.getDepartmentId());
if (d != null) {
u.setDepartmentTitle(d.getTitle());
@ -414,7 +414,7 @@ public class UserController {
} else {
u.setDepartmentId(null);
u.setDepartmentTitle("");
}
}*/
u.setPassword(old.getPassword());
// 是否有维护成本权限 1:是;0否

14
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductCategoryController.java

@ -57,8 +57,12 @@ public class ProductCategoryController {
@ApiOperation(value = "根据id修改货品类别")
public Result updateSpuById(ProductCategory productCategory) {
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
productCategory.setShopId(shopId);
if (StringUtils.isEmpty(productCategory.getShopId())) {
final String shopId = securityUtil.getShopId();
productCategory.setShopId(shopId);
} else {
productCategory.setShopId(productCategory.getShopId());
}
boolean result = productCategoryService.updateById(productCategory);
if (result) {
return ResultUtil.success("修改成功");
@ -82,10 +86,12 @@ public class ProductCategoryController {
@RequestMapping(value = "/list", method = RequestMethod.GET)
@ApiOperation(value = "查询货品类别列表")
public Result list() {
public Result list(String shopId) {
// QueryWrapper<ProductCategory> queryWrapper = new QueryWrapper<>();
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
if(shopId == null || shopId.isEmpty()){
shopId = securityUtil.getShopId();
}
// final String shopId = "1759768115375378438";
// queryWrapper.eq("shop_id", shopId);
List<ProductCategoryVo2> list = productCategoryService.getCategoryListByShopId(shopId);

32
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ProductController.java

@ -10,7 +10,6 @@ import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.entity.Product;
import cc.hiver.mall.entity.ProductGroupBuyPrice;
import cc.hiver.mall.pojo.query.ProductPageQuery;
import cc.hiver.mall.pojo.vo.ProductCategoryVo;
import cc.hiver.mall.pojo.vo.ProductLastBuyVo;
import cc.hiver.mall.pojo.vo.ProductPageVO;
import cc.hiver.mall.pojo.vo.ProductVo;
@ -31,7 +30,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
@Slf4j
@RestController
@ -60,15 +58,15 @@ public class ProductController {
// 20240824 增加修改的商品货号不能重复
// 根据货号查询商品是否存在
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
final CopyOnWriteArrayList<Product> oldProductListBySn = productService.getByProductSn(productVo.getProductSn(), shopId,"");
if (oldProductListBySn != null && !oldProductListBySn.isEmpty()) {
//final String shopId = securityUtil.getShopId();
//final CopyOnWriteArrayList<Product> oldProductListBySn = productService.getByProductSn(productVo.getProductSn(), shopId,"");
/*if (oldProductListBySn != null && !oldProductListBySn.isEmpty()) {
return ResultUtil.error("您已有货号"+productVo.getProductSn()+"的商品,请更换货号");
}
}*/
final Product product = new Product();
BeanUtils.copyBeanProp(product, productVo);
// 新增商品专属分类信息
final ProductCategoryVo productCategoryVo = productVo.getProductCategoryVo();
/*final ProductCategoryVo productCategoryVo = productVo.getProductCategoryVo();
productCategoryVo.setShopId("spfl");
final String attrId = productCategoryService.batchSaveCategoryAndAttribute(productCategoryVo);
// 更新店铺尺码库
@ -78,8 +76,8 @@ public class ProductController {
product.setAttrId(attrId);
} else {
return ResultUtil.error("添加分类信息失败");
}
product.setShopId(shopId);
}*/
//product.setShopId(shopId);
// 新增的默认为已上架
product.setDelFlag(CommonConstant.DEL_FLAG_TRUE);
// 处理前台的错误传参
@ -98,6 +96,9 @@ public class ProductController {
// 如果有拼团信息,那么新增拼团信息
final List<ProductGroupBuyPrice> productGroupBuyPrices = productVo.getProductGroupBuyPrices();
for (ProductGroupBuyPrice productGroupBuyPrice : productGroupBuyPrices) {
productGroupBuyPrice.setProductId(product.getId());
}
if (productGroupBuyPrices != null && !productGroupBuyPrices.isEmpty()) {
productGroupBuyPriceService.saveBatch(productGroupBuyPrices);
}
@ -114,17 +115,17 @@ public class ProductController {
// 20240824 增加修改的商品货号不能重复
// 根据货号查询商品是否存在
// shopId从缓存中设置
final String shopId = securityUtil.getShopId();
/*final String shopId = securityUtil.getShopId();
final CopyOnWriteArrayList<Product> oldProductListBySn = productService.getByProductSn(productVo.getProductSn(), shopId,"");
if (oldProductListBySn != null && !oldProductListBySn.isEmpty()) {
// 如果旧商品id不等于前台传递的商品id,则返回信息
if (!productVo.getId().equals(oldProductListBySn.get(0).getId())) {
return ResultUtil.error("您已有货号"+productVo.getProductSn()+"的商品,请更换货号");
}
}
}*/
final Product product = new Product();
BeanUtils.copyBeanProp(product, productVo);
// 删除商品专属分类信息
/* // 删除商品专属分类信息
productCategoryService.deleteCategoryOfProduct1(productVo.getAttrId());
// 新增商品专属分类信息
final ProductCategoryVo productCategoryVo = productVo.getProductCategoryVo();
@ -137,7 +138,7 @@ public class ProductController {
product.setAttrId(attrId);
} else {
return ResultUtil.error("添加分类信息失败");
}
}*/
// 处理前台的错误传参
if("[]".equals(product.getCustomerCategoryRule()) || "null".equals(product.getCustomerCategoryRule())){
product.setCustomerCategoryRule("");
@ -156,7 +157,11 @@ public class ProductController {
}
// 如果有拼团信息,那么新增拼团信息
final List<ProductGroupBuyPrice> productGroupBuyPrices = productVo.getProductGroupBuyPrices();
for (ProductGroupBuyPrice productGroupBuyPrice : productGroupBuyPrices) {
productGroupBuyPrice.setProductId(product.getId());
}
if (productGroupBuyPrices != null && !productGroupBuyPrices.isEmpty()) {
productGroupBuyPriceService.deleteByProductId(productVo.getId());
productGroupBuyPriceService.saveBatch(productGroupBuyPrices);
}
if (result) {
@ -361,6 +366,7 @@ public class ProductController {
@ApiOperation("根据id查询商品信息")
public Result<Product> getById(@PathVariable String id,String customerId) {
final Product byId = productService.getByIdOrBrcode(id, customerId);
byId.setProductGroupBuyPrices(productGroupBuyPriceService.selectByProductId(id));
if (byId != null) {
return new ResultUtil<Product>().setData(byId);
} else {

9
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/ShopTakeawayController.java

@ -17,9 +17,7 @@ package cc.hiver.mall.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.entity.Sale;
import cc.hiver.mall.entity.ShopTakeaway;
import cc.hiver.mall.pojo.query.SalePageQuery;
import cc.hiver.mall.pojo.query.ShopTakeawayQuery;
import cc.hiver.mall.service.ShopTakeawayService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -32,7 +30,6 @@ import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
* 店铺外卖业务配置控制器
@ -61,13 +58,13 @@ public class ShopTakeawayController {
@ResponseBody
public Result<ShopTakeaway> save(ShopTakeaway shopTakeaway) {
// 1. 获取当前时间
LocalDateTime now = LocalDateTime.now();
final LocalDateTime now = LocalDateTime.now();
// 2. 定义格式化器 (例如:yyyy-MM-dd HH:mm:ss)
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
// 3. 转换为字符串
String timeStr = now.format(formatter);
final String timeStr = now.format(formatter);
shopTakeaway.setJoinTime(timeStr);
final ShopTakeaway result = shopTakeawayService.insert(shopTakeaway);
return new ResultUtil<ShopTakeaway>().setData(result);

65
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/controller/WorkerRelaPriceController.java

@ -0,0 +1,65 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.controller;
import cc.hiver.core.common.utils.ResultUtil;
import cc.hiver.core.common.vo.Result;
import cc.hiver.mall.entity.WorkerRelaPrice;
import cc.hiver.mall.service.mybatis.WorkerRelaPriceService;
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.web.bind.annotation.*;
import java.util.List;
/**
* 店铺外卖业务配置控制器
*
* @author cc
*/
@Slf4j
@RestController
@Api(tags = "配送员佣金设定")
@RequestMapping("/hiver/app/workerRelaPrice")
public class WorkerRelaPriceController {
@Autowired
private WorkerRelaPriceService workerRelaPriceService;
@RequestMapping(value = "/getByWorkerId", method = RequestMethod.GET)
@ApiOperation("根据配送员id获取")
public Result<List<WorkerRelaPrice>> getByProductId(@RequestParam String workerId) {
final List<WorkerRelaPrice> workerRelaPriceList = workerRelaPriceService.selectByWorkerId(workerId);
return new ResultUtil<List<WorkerRelaPrice>>().setData(workerRelaPriceList);
}
@PostMapping(value = "/batchAdd")
@ApiOperation("批量新增")
public Result batchAdd(@RequestBody List<WorkerRelaPrice> workerRelaPrice) {
if(workerRelaPrice != null && !workerRelaPrice.isEmpty()){
workerRelaPriceService.deleteByWorkerId(workerRelaPrice.get(0).getWorkerId());
}
// 批量新增
final boolean b = workerRelaPriceService.saveBatch(workerRelaPrice);
if (b) {
return ResultUtil.success("保存成功!");
} else {
return ResultUtil.error("保存失败!");
}
}
}

18
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/dao/mapper/WorkerRelaPriceMapper.java

@ -0,0 +1,18 @@
package cc.hiver.mall.dao.mapper;
import cc.hiver.mall.entity.WorkerRelaPrice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface WorkerRelaPriceMapper extends BaseMapper<WorkerRelaPrice> {
int insert(WorkerRelaPrice record);
List<WorkerRelaPrice> selectByWorkerId(String workerId);
void deleteByWorkerId(String workerId);
}

18
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/Product.java

@ -44,6 +44,9 @@ public class Product implements Serializable {
@ApiModelProperty(value = "商品是否上架 0-否 1-是")
private Integer delFlag;
@ApiModelProperty(value = "商品排序")
private Integer orderFiled;
@ApiModelProperty(value = "更新者")
@LastModifiedBy
@TableField(fill = FieldFill.UPDATE)
@ -74,6 +77,15 @@ public class Product implements Serializable {
@ApiModelProperty(value = "商品属性列表")
private String attributeList;
@ApiModelProperty(value = "商品规格列表")
private String attributeListPrice;
@ApiModelProperty(value = "是否为推荐 0不是 1是")
private Integer isPush;
@ApiModelProperty(value = "是否为必点 0不是 1是")
private Integer isMust;
@ApiModelProperty(value = "供应商")
private String supplierId;
@ -110,6 +122,12 @@ public class Product implements Serializable {
@ApiModelProperty(value = "尾货预警日期")
private Date salesWeek;
@ApiModelProperty(value = "开始售卖时间")
private Date sellBeginTime;
@ApiModelProperty(value = "结束售卖时间")
private Date sellEndTime;
@ApiModelProperty(value = "打印条码(自己制作的)")
private String printBarcode;

16
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/ProductGroupBuyPrice.java

@ -1,22 +1,6 @@
/*
Copyright [2022] [https://hiver.cc]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package cc.hiver.mall.entity;
import cc.hiver.core.base.HiverBaseEntity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

53
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/entity/WorkerRelaPrice.java

@ -0,0 +1,53 @@
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;
import java.math.BigDecimal;
/**
* 配送员价格配置实体类
*
* @author cc
*/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@Table(name = "t_worker_rela_price")
@TableName("t_worker_rela_price")
@ApiModel(value = "配送员价格配置")
public class WorkerRelaPrice extends HiverBaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "配送员id")
private String workerId;
@ApiModelProperty(value = "取货区域id")
private String getAreaId;
@ApiModelProperty(value = "取货区域名称")
private String getAreaName;
@ApiModelProperty(value = "送货区域id")
private String putAreaId;
@ApiModelProperty(value = "送货区域名称")
private String putAreaName;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "配送佣金")
private BigDecimal orderBkge;
@ApiModelProperty(value = "配送类型")
private Integer orderType;
}

18
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductPageVO.java

@ -42,6 +42,9 @@ public class ProductPageVO {
@ApiModelProperty(value = "商品是否上架 0-否 1-是")
private Integer delFlag;
@ApiModelProperty(value = "商品排序")
private Integer orderFiled;
@ApiModelProperty(value = "商品名称")
private String productName;
@ -60,6 +63,15 @@ public class ProductPageVO {
@ApiModelProperty(value = "商品属性列表")
private String attributeList;
@ApiModelProperty(value = "商品规格列表")
private String attributeListPrice;
@ApiModelProperty(value = "是否为推荐 0不是 1是")
private Integer isPush;
@ApiModelProperty(value = "是否为必点 0不是 1是")
private Integer isMust;
@ApiModelProperty(value = "供应商")
private String supplierId;
@ -99,6 +111,12 @@ public class ProductPageVO {
@ApiModelProperty(value = "销售周期")
private Date salesWeek;
@ApiModelProperty(value = "开始售卖时间")
private Date sellBeginTime;
@ApiModelProperty(value = "结束售卖时间")
private Date sellEndTime;
@ApiModelProperty(value = "打印条码(自己制作的)")
private String printBarcode;

18
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/pojo/vo/ProductVo.java

@ -20,6 +20,9 @@ public class ProductVo extends HiverBaseEntity {
@ApiModelProperty(value = "商品是否上架 0-否 1-是")
private Integer delFlag;
@ApiModelProperty(value = "商品排序")
private Integer orderFiled;
@ApiModelProperty(value = "商品名称")
private String productName;
@ -38,6 +41,15 @@ public class ProductVo extends HiverBaseEntity {
@ApiModelProperty(value = "商品属性列表")
private String attributeList;
@ApiModelProperty(value = "商品规格列表")
private String attributeListPrice;
@ApiModelProperty(value = "是否为推荐 0不是 1是")
private Integer isPush;
@ApiModelProperty(value = "是否为必点 0不是 1是")
private Integer isMust;
@ApiModelProperty(value = "供应商")
private String supplierId;
@ -74,6 +86,12 @@ public class ProductVo extends HiverBaseEntity {
@ApiModelProperty(value = "尾货预警日期")
private Date salesWeek;
@ApiModelProperty(value = "开始售卖时间")
private Date sellBeginTime;
@ApiModelProperty(value = "结束售卖时间")
private Date sellEndTime;
@ApiModelProperty(value = "打印条码(自己制作的)")
private String printBarcode;

15
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/service/mybatis/WorkerRelaPriceService.java

@ -0,0 +1,15 @@
package cc.hiver.mall.service.mybatis;
import cc.hiver.mall.entity.WorkerRelaPrice;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
public interface WorkerRelaPriceService extends IService<WorkerRelaPrice> {
WorkerRelaPrice insert(WorkerRelaPrice record);
List<WorkerRelaPrice> selectByWorkerId(String workerId);
void deleteByWorkerId(String workerId);
}

4
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/ProductCategoryServiceImpl.java

@ -431,7 +431,7 @@ public class ProductCategoryServiceImpl extends ServiceImpl<ProductCategoryMappe
productCategoryVo.setShopId("dpggk");
productCategoryVo.setCategoryName("店铺规格库");
final CopyOnWriteArrayList<ProductAttributeOfAddVo> productAttributeOfAddVos = new CopyOnWriteArrayList<>();
/*final CopyOnWriteArrayList<ProductAttributeOfAddVo> productAttributeOfAddVos = new CopyOnWriteArrayList<>();
// 新增颜色
final ProductAttributeOfAddVo productAttributeOfAddVo = new ProductAttributeOfAddVo();
productAttributeOfAddVo.setAttributeName("颜色");
@ -455,7 +455,7 @@ public class ProductCategoryServiceImpl extends ServiceImpl<ProductCategoryMappe
// 回填尺码到分类中
productAttributeOfAddVos.add(sizeProductAttributeOfAddVo);
productCategoryVo.setProductAttributeOfAddVos(productAttributeOfAddVos);
productCategoryVo.setProductAttributeOfAddVos(productAttributeOfAddVos);*/
// 批量去新增
return batchSaveCategoryAndAttribute(productCategoryVo);

35
hiver-modules/hiver-mall/src/main/java/cc/hiver/mall/serviceimpl/mybatis/WorkerRelaPriceServiceImpl.java

@ -0,0 +1,35 @@
package cc.hiver.mall.serviceimpl.mybatis;
import cc.hiver.mall.dao.mapper.WorkerRelaPriceMapper;
import cc.hiver.mall.entity.WorkerRelaPrice;
import cc.hiver.mall.service.mybatis.WorkerRelaPriceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
@Slf4j
public class WorkerRelaPriceServiceImpl extends ServiceImpl<WorkerRelaPriceMapper, WorkerRelaPrice> implements WorkerRelaPriceService {
@Autowired
private WorkerRelaPriceMapper workerRelaPriceMapper;
@Override
public WorkerRelaPrice insert(WorkerRelaPrice record) {
workerRelaPriceMapper.insert(record);
return record;
}
@Override
public List<WorkerRelaPrice> selectByWorkerId(String workerId) {
return workerRelaPriceMapper.selectByWorkerId(workerId);
}
@Override
public void deleteByWorkerId(String workerId) {
workerRelaPriceMapper.deleteByWorkerId(workerId);
}
}

184
hiver-modules/hiver-mall/src/main/resources/mapper/ProductMapper.xml

@ -30,6 +30,12 @@
<result column="tail_warn" jdbcType="INTEGER" property="tailWarn"/>
<result column="in_storage_status" jdbcType="INTEGER" property="inStorageStatus"/>
<result column="customer_category_rule" jdbcType="VARCHAR" property="customerCategoryRule"/>
<result column="attribute_list_price" jdbcType="VARCHAR" property="attributeListPrice"/>
<result column="is_push" jdbcType="INTEGER" property="isPush"/>
<result column="is_must" jdbcType="INTEGER" property="isMust"/>
<result column="order_filed" jdbcType="INTEGER" property="orderFiled"/>
<result column="sell_begin_time" jdbcType="TIMESTAMP" property="sellBeginTime"/>
<result column="sell_end_time" jdbcType="TIMESTAMP" property="sellEndTime"/>
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -95,7 +101,7 @@
id, create_by, create_time, del_flag, update_by, update_time, product_name, unit,
shop_id, category_id,attr_id, attribute_list, supplier_id,supplier_name, product_sn, barcode, price, purchase_price,commission,
wholesale_price, product_picture, product_video, product_intro, sales_week, print_barcode,
tail_warn,in_storage_status,customer_category_rule
tail_warn,in_storage_status,customer_category_rule, attribute_list_price, is_push, is_must, order_filed, sell_begin_time, sell_end_time
</sql>
<select id="selectByExample" parameterType="cc.hiver.mall.entity.ProductExample" resultMap="BaseResultMap">
select
@ -136,7 +142,8 @@
product_sn, barcode, price,
purchase_price, commission, wholesale_price, product_picture,
product_video, product_intro, sales_week,
print_barcode, tail_warn,in_storage_status,customer_category_rule)
print_barcode, tail_warn,in_storage_status,customer_category_rule,
attribute_list_price,is_push,is_must,order_filed,sell_begin_time, sell_end_time)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{productName,jdbcType=VARCHAR}, #{unit,jdbcType=VARCHAR}, #{shopId,jdbcType=VARCHAR},
@ -146,7 +153,8 @@
#{productPicture,jdbcType=VARCHAR},
#{productVideo,jdbcType=VARCHAR}, #{productIntro,jdbcType=VARCHAR}, #{salesWeek,jdbcType=TIMESTAMP},
#{printBarcode,jdbcType=VARCHAR}, #{tailWarn,jdbcType=INTEGER}, #{inStorageStatus,jdbcType=INTEGER},
#{customerCategoryRule,jdbcType=VARCHAR})
#{customerCategoryRule,jdbcType=VARCHAR},#{attributeListPrice,jdbcType=VARCHAR},
#{isPush,jdbcType=INTEGER}, #{isMust,jdbcType=INTEGER}, #{orderFiled,jdbcType=INTEGER},#{sellBeginTime,jdbcType=TIMESTAMP},#{sellEndTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="cc.hiver.mall.entity.Product">
insert into t_product
@ -232,6 +240,24 @@
<if test="customerCategoryRule != null">
customer_category_rule,
</if>
<if test="attributeListPrice != null">
attribute_list_price,
</if>
<if test="isPush != null">
is_push,
</if>
<if test="isMust != null">
is_must
</if>
<if test="orderFiled != null">
order_filed
</if>
<if test="sellBeginTime != null">
sell_begin_time
</if>
<if test="sellEndTime != null">
sell_end_time
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -315,6 +341,24 @@
<if test="customerCategoryRule != null">
#{customerCategoryRule,jdbcType=VARCHAR},
</if>
<if test="attributeListPrice != null">
#{attributeListPrice,jdbcType=VARCHAR},
</if>
<if test="isPush != null">
#{isPush,jdbcType=INTEGER},
</if>
<if test="isMust != null">
#{isMust,jdbcType=INTEGER},
</if>
<if test="orderFiled != null">
#{orderFiled,jdbcType=INTEGER}
</if>
<if test="sellBeginTime != null">
#{sellBeginTime,jdbcType=TIMESTAMP},
</if>
<if test="sellEndTime != null">
#{sellEndTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="cc.hiver.mall.entity.ProductExample" resultType="java.lang.Long">
@ -407,6 +451,24 @@
<if test="record.customerCategoryRule != null">
customer_category_rule = #{record.customerCategoryRule,jdbcType=VARCHAR},
</if>
<if test="record.attributeListPrice != null">
attribute_list_price = #{record.attributeListPrice,jdbcType=VARCHAR},
</if>
<if test="record.isPush != null">
is_push = #{record.isPush,jdbcType=INTEGER},
</if>
<if test="record.isMust != null">
is_must = #{record.isMust,jdbcType=INTEGER},
</if>
<if test="record.orderFiled != null">
order_filed = #{record.orderFiled,jdbcType=INTEGER}
</if>
<if test="record.sellBeginTime != null">
sell_begin_time = #{record.sellBeginTime,jdbcType=TIMESTAMP},
</if>
<if test="record.sellEndTime != null">
sell_end_time = #{record.sellEndTime,jdbcType=TIMESTAMP}
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
@ -440,7 +502,13 @@
print_barcode = #{record.printBarcode,jdbcType=VARCHAR},
tail_warn = #{record.tailWarn,jdbcType=INTEGER},
in_storage_status = #{record.inStorageStatus,jdbcType=INTEGER},
customer_category_rule = #{record.customerCategoryRule,jdbcType=VARCHAR}
customer_category_rule = #{record.customerCategoryRule,jdbcType=VARCHAR},
attribute_list_price = #{record.attributeListPrice,jdbcType=VARCHAR},
is_push = #{record.isPush,jdbcType=INTEGER},
is_must = #{record.isMust,jdbcType=INTEGER},
order_filed = #{record.orderFiled,jdbcType=INTEGER},
sell_begin_time = #{record.sellBeginTime,jdbcType=TIMESTAMP},
sell_end_time = #{record.sellEndTime,jdbcType=TIMESTAMP}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
@ -526,6 +594,24 @@
<if test="customerCategoryRule != null">
customer_category_rule = #{customerCategoryRule,jdbcType=VARCHAR},
</if>
<if test="attributeListPrice != null">
attribute_list_price = #{attributeListPrice,jdbcType=VARCHAR},
</if>
<if test="isPush != null">
is_push = #{isPush,jdbcType=INTEGER},
</if>
<if test="isMust != null">
is_must = #{isMust,jdbcType=INTEGER},
</if>
<if test="orderFiled != null">
order_filed = #{orderFiled,jdbcType=INTEGER}
</if>
<if test="sellBeginTime != null">
sell_begin_time = #{sellBeginTime,jdbcType=TIMESTAMP},
</if>
<if test="sellEndTime != null">
sell_end_time = #{sellEndTime,jdbcType=TIMESTAMP},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -556,7 +642,13 @@
print_barcode = #{printBarcode,jdbcType=VARCHAR},
tail_warn = #{tailWarn,jdbcType=INTEGER},
in_storage_status = #{inStorageStatus,jdbcType=INTEGER},
customer_category_rule = #{customerCategoryRule,jdbcType=VARCHAR}
customer_category_rule = #{customerCategoryRule,jdbcType=VARCHAR},
attribute_list_price = #{attributeListPrice,jdbcType=VARCHAR},
is_push = #{isPush,jdbcType=INTEGER},
is_must = #{isMust,jdbcType=INTEGER},
order_filed = #{orderFiled,jdbcType=INTEGER},
sell_begin_time = #{sellBeginTime,jdbcType=TIMESTAMP},
sell_end_time = #{sellEndTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=VARCHAR}
</update>
@ -591,49 +683,14 @@
t.tail_warn,
t.in_storage_status,
t.customer_category_rule,
COALESCE(ss.stock_count + ss.minus_stock_count, 0) AS total_stock_count,
COALESCE(ss.stock_count, 0) AS stock_count,
COALESCE(ss.minus_stock_count, 0) AS minus_stock_count
<if test='queryParams.startDate !=null and queryParams.startDate.trim() neq "" and queryParams.endDate !=null and queryParams.endDate.trim() neq ""'>
, COALESCE(sd.total_sold, 0) AS total_sold
</if>
t.attribute_list_price,
t.is_push,
t.is_must,
t.order_filed,
t.sell_begin_time,
t.sell_end_time
FROM t_product t
LEFT JOIN (
SELECT
sum( CASE WHEN s.stock_count &lt; 0 THEN 0 ELSE s.stock_count END ) AS stock_count,
sum( CASE WHEN s.stock_count > 0 THEN 0 ELSE s.stock_count END ) AS minus_stock_count,
shop_id,
product_id
FROM
t_stock s
GROUP BY
shop_id,
product_id
) ss
ON ss.product_id = t.id
and ss.shop_id = t.shop_id
<if test='queryParams.startDate !=null and queryParams.startDate.trim() neq "" and queryParams.endDate !=null and queryParams.endDate.trim() neq ""'>
LEFT JOIN (
SELECT
sd.product_id,
SUM(sd.product_count) AS total_sold
FROM
t_sale_detail sd
INNER JOIN t_sale s ON sd.sale_id = s.id
WHERE
s.del_flag = '0'
AND s.status = '4'
and s.create_time BETWEEN #{queryParams.startDate} AND #{queryParams.endDate}
<!--<if test='(queryParams.startDate == null or queryParams.startDate eq "" ) and (queryParams.endDate == null or queryParams.endDate eq "")'>
and s.create_time >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)
</if>-->
GROUP BY
product_id
) sd ON t.id = sd.product_id
</if>
<where>
<!--已上架的-->
AND t.del_flag != '2'
<!--店铺id-->
<if test='queryParams.shopId!=null and queryParams.shopId.trim() neq ""'>
AND t.shop_id = #{queryParams.shopId}
@ -647,25 +704,12 @@
AND t.category_id =#{queryParams.categoryId}
</if>
<!--供应商id-->
<if test='queryParams.supplierId!=null and queryParams.supplierId.trim() neq ""'>
AND t.supplier_id =#{queryParams.supplierId}
</if>
<!--商品名称-->
<if test='queryParams.productName!=null and queryParams.productName.trim() neq ""'>
AND t.product_name like concat('%',#{queryParams.productName},'%')
</if>
<!--货号-->
<if test='queryParams.productSn!=null and queryParams.productSn.trim() neq ""'>
AND t.product_sn like concat('%',#{queryParams.productSn},'%')
</if>
<!--供应商名称-->
<if test='queryParams.supplierName!=null and queryParams.supplierName.trim() neq ""'>
AND t.supplier_name like concat('%',#{queryParams.supplierName},'%')
</if>
<if test='queryParams.idList!=null '>
and id in
and t.id in
<foreach item="item" index="index" collection="queryParams.idList" open="(" close=")" separator=",">
#{item}
</foreach>
@ -673,27 +717,17 @@
<if test="queryParams.searchStr != null and queryParams.searchStr != ''">
and (
t.product_name like concat('%',#{queryParams.searchStr},'%')
or t.product_sn like concat('%',#{queryParams.searchStr},'%')
or t.supplier_name like concat('%',#{queryParams.searchStr},'%')
)
</if>
</where>
ORDER BY
<if test="queryParams.searchStr != null and queryParams.searchStr != ''">
LENGTH(product_sn),
CASE
WHEN product_sn LIKE CONCAT(#{queryParams.searchStr}, '%') THEN 1
WHEN product_sn LIKE CONCAT('%',#{queryParams.searchStr}) THEN 2
ELSE 3
END,
</if>
<!--销量排序-->
ORDER BY t.order_filed asc,
<!--销量排序
<if test='queryParams.startDate !=null and queryParams.startDate.trim() neq "" and queryParams.endDate !=null and queryParams.endDate.trim() neq ""'>
<if test='queryParams.sortField!=null and queryParams.sortField.trim() neq "" and queryParams.sortField eq "totalSold"'>
sd.total_sold desc,
</if>
</if>
<!-- 如果sort字段为stockCount,则按照total_stock_count库存数排序 -->
</if>-->
<!-- 如果sort字段为stockCount,则按照total_stock_count库存数排序
<if test='queryParams.sort !=null and queryParams.sort.trim() eq "stockCount" and queryParams.order !=null and queryParams.order.trim() neq "" '>
<if test='queryParams.order.trim() eq "desc" '>
total_stock_count desc ,
@ -701,7 +735,7 @@
<if test='queryParams.order.trim() eq "asc" '>
total_stock_count asc ,
</if>
</if>
</if> -->
t.in_storage_status asc, t.del_flag desc,t.create_time desc, id
</select>

48
hiver-modules/hiver-mall/src/main/resources/mapper/WorkerRelaPriceMapper.xml

@ -0,0 +1,48 @@
<?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.WorkerRelaPriceMapper">
<resultMap id="BaseResultMap" type="cc.hiver.mall.entity.WorkerRelaPrice">
<id column="id" jdbcType="VARCHAR" property="id"/>
<result column="create_by" jdbcType="VARCHAR" property="createBy"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
<result column="update_by" jdbcType="VARCHAR" property="updateBy"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="worker_id" jdbcType="VARCHAR" property="workerId"/>
<result column="get_area_id" jdbcType="VARCHAR" property="getAreaId"/>
<result column="get_area_name" jdbcType="VARCHAR" property="getAreaName"/>
<result column="put_area_id" jdbcType="VARCHAR" property="putAreaId"/>
<result column="put_area_name" jdbcType="VARCHAR" property="putAreaName"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="order_type" jdbcType="INTEGER" property="orderType"/>
<result column="order_bkge" jdbcType="DECIMAL" property="orderBkge"/>
</resultMap>
<sql id="Base_Column_List">
id, create_by, create_time, del_flag, update_by, update_time, worker_id, get_area_id, get_area_name, put_area_id, put_area_name, ramark, order_type, order_bkge
</sql>
<insert id="insert" parameterType="cc.hiver.mall.entity.ProductGroupBuyPrice">
insert into t_worker_rela_price (id, create_by, create_time,
del_flag, update_by, update_time,
worker_id, get_area_id, get_area_name, put_area_id, put_area_name, remark, order_type, order_bkge)
values (#{id,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
#{delFlag,jdbcType=INTEGER}, #{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
#{workerId,jdbcType=VARCHAR}, #{getAreaId,jdbcType=VARCHAR}, #{getAreaName,jdbcType=VARCHAR},
#{putAreaId,jdbcType=VARCHAR}, #{putAreaName,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{orderType,jdbcType=INTEGER}, #{orderBkge,jdbcType=DECIMAL})
</insert>
<select id="selectByWorkerId" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from t_worker_rela_price
where worker_id = #{workerId,jdbcType=VARCHAR}
</select>
<delete id="deleteByWorkerId" parameterType="java.lang.String">
delete
from t_worker_rela_price
where worker_id = #{workerId,jdbcType=VARCHAR}
</delete>
</mapper>
Loading…
Cancel
Save