b2c模式代码提交

This commit is contained in:
chc
2024-10-18 15:30:07 +08:00
parent e89be8eb8c
commit 9d3ed4a4a7
25 changed files with 508 additions and 62 deletions

View File

@@ -288,7 +288,7 @@ lili:
after-sale-topic: shop_lili_after_sale_topic
after-sale-group: shop_lili_after_sale_group
rocketmq:
name-server: 192.168.31.100:30876
name-server: 192.168.31.100:9876
isVIPChannel: false
producer:
group: lili_group

View File

@@ -464,6 +464,7 @@ public enum ResultCode {
ORDER_SETTING_ERROR(70006, "系统订单配置异常"),
ALI_SMS_SETTING_ERROR(70007, "您还未配置阿里云短信"),
SMS_SIGN_EXIST_ERROR(70008, "短信签名已存在"),
DELIVERY_SETTING_ERROR(70009, "请配置发货参数"),
/**
* 站内信

View File

@@ -114,7 +114,7 @@ public class GoodsImportServiceImpl implements GoodsImportService {
List<String> freightTemplateNameList = new ArrayList<>();
//循环列表存放ID-运费模板名称
for (FreightTemplateVO freightTemplateVO : freightTemplateService.getFreightTemplateList(storeId)) {
for (FreightTemplateVO freightTemplateVO : freightTemplateService.getFreightTemplateList()) {
freightTemplateNameList.add(freightTemplateVO.getId() + "-" + freightTemplateVO.getName());
}

View File

@@ -35,6 +35,7 @@ import cn.lili.modules.store.service.FreightTemplateService;
import cn.lili.modules.store.service.StoreService;
import cn.lili.modules.system.aspect.annotation.SystemLogPoint;
import cn.lili.modules.system.entity.dos.Setting;
import cn.lili.modules.system.entity.dto.BaseSetting;
import cn.lili.modules.system.entity.dto.GoodsSetting;
import cn.lili.modules.system.entity.enums.SettingEnum;
import cn.lili.modules.system.service.SettingService;
@@ -663,20 +664,14 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
//获取商品系统配置决定是否审核
Setting setting = settingService.get(SettingEnum.GOODS_SETTING.name());
GoodsSetting goodsSetting = JSONUtil.toBean(setting.getSettingValue(), GoodsSetting.class);
Setting baseSetting = settingService.get(SettingEnum.BASE_SETTING.name());
BaseSetting baseSettingValue = JSONUtil.toBean(baseSetting.getSettingValue(), BaseSetting.class);
//是否需要审核
goods.setAuthFlag(Boolean.TRUE.equals(goodsSetting.getGoodsCheck()) ? GoodsAuthEnum.TOBEAUDITED.name() : GoodsAuthEnum.PASS.name());
//判断当前用户是否为店铺
if (Objects.requireNonNull(UserContext.getCurrentUser()).getRole().equals(UserEnums.STORE)) {
StoreVO storeDetail = this.storeService.getStoreDetail();
if (storeDetail.getSelfOperated() != null) {
goods.setSelfOperated(storeDetail.getSelfOperated());
}
goods.setStoreId(storeDetail.getId());
goods.setStoreName(storeDetail.getStoreName());
goods.setSelfOperated(storeDetail.getSelfOperated());
} else {
throw new ServiceException(ResultCode.STORE_NOT_LOGIN_ERROR);
}
//平台商品,默认处理
goods.setStoreId("-1");
goods.setStoreName(baseSettingValue.getSiteName());
goods.setSelfOperated(true);
}
/**

View File

@@ -1,6 +1,7 @@
package cn.lili.modules.logistics.plugin.kdniao;
import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.json.JSONUtil;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.modules.logistics.LogisticsPlugin;
@@ -12,8 +13,13 @@ import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
import cn.lili.modules.store.entity.dos.StoreLogistics;
import cn.lili.modules.store.entity.dto.StoreDeliverGoodsAddressDTO;
import cn.lili.modules.system.entity.dos.Logistics;
import cn.lili.modules.system.entity.dos.Setting;
import cn.lili.modules.system.entity.dto.DeliverySetting;
import cn.lili.modules.system.entity.dto.LogisticsSetting;
import cn.lili.modules.system.entity.dto.payment.UnionPaymentSetting;
import cn.lili.modules.system.entity.enums.SettingEnum;
import cn.lili.modules.system.entity.vo.Traces;
import cn.lili.modules.system.service.SettingService;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
@@ -40,6 +46,9 @@ public class KdniaoPlugin implements LogisticsPlugin {
@Autowired
private LogisticsSetting logisticsSetting;
@Autowired
private SettingService settingService;
public KdniaoPlugin(LogisticsSetting logisticsSetting) {
this.logisticsSetting = logisticsSetting;
}
@@ -124,31 +133,41 @@ public class KdniaoPlugin implements LogisticsPlugin {
//收件人地址
String[] ConsigneeAddress = order.getConsigneeAddressPath().split(",");
//获取店家信息
StoreDeliverGoodsAddressDTO storeDeliverGoodsAddressDTO = labelOrderDTO.getStoreDeliverGoodsAddressDTO();
// StoreDeliverGoodsAddressDTO storeDeliverGoodsAddressDTO = labelOrderDTO.getStoreDeliverGoodsAddressDTO();
//发件人地址
String[] consignorAddress = storeDeliverGoodsAddressDTO.getSalesConsignorAddressPath().split(",");
// String[] consignorAddress = storeDeliverGoodsAddressDTO.getSalesConsignorAddressPath().split(",");
//店铺-物流公司设置
StoreLogistics storeLogistics = labelOrderDTO.getStoreLogistics();
// StoreLogistics storeLogistics = labelOrderDTO.getStoreLogistics();
Setting systemSetting = settingService.get(SettingEnum.DELIVERY_SETTING.name());
DeliverySetting deliverySetting = JSONUtil.toBean(systemSetting.getSettingValue(), DeliverySetting.class);
if(deliverySetting.getSalesConsignorName() == null
|| deliverySetting.getSalesConsignorAddressId() == null
|| deliverySetting.getSalesConsignorAddressPath() == null
|| deliverySetting.getSalesConsignorMobile() == null
|| deliverySetting.getSalesConsignorDetail() == null){
throw new ServiceException(ResultCode.DELIVERY_SETTING_ERROR);
}
String[] consignorAddress = deliverySetting.getSalesConsignorAddressPath().split(",");
//组装快递鸟应用级参数
String resultDate = "{" +
"'OrderCode': '" + order.getSn() + "'," + //订单编码
"'ShipperCode': '" + logistics.getCode() + "'," + //快递公司编码
"'CustomerName': '" + storeLogistics.getCustomerName() + "'," +//客户编码
"'CustomerPwd': '" + storeLogistics.getCustomerPwd() + "'," + //客户密码
"'MonthCode': '" + storeLogistics.getMonthCode() + "'," + //密钥
"'SendSite': '" + storeLogistics.getSendSite() + "'," + //归属网点
"'SendStaff': '" + storeLogistics.getSendStaff() + "'," + //收件快递员
"'PayType': " + storeLogistics.getPayType() + "," +
"'ExpType': " + storeLogistics.getExpType() + "," +
"'CustomerName': '" + logistics.getCustomerName() + "'," +//客户编码
"'CustomerPwd': '" + logistics.getCustomerPwd() + "'," + //客户密码
"'MonthCode': '" + logistics.getMonthCode() + "'," + //密钥
"'SendSite': '" + logistics.getSendSite() + "'," + //归属网点
"'SendStaff': '" + logistics.getSendStaff() + "'," + //收件快递员
"'PayType': " + logistics.getPayType() + "," +
"'ExpType': " + logistics.getExpType() + "," +
//发件人信息
"'Sender': {" +
"'Name': '" + storeDeliverGoodsAddressDTO.getSalesConsignorName() + "'," +
"'Mobile': '" + storeDeliverGoodsAddressDTO.getSalesConsignorMobile() + "'," +
"'Name': '" + deliverySetting.getSalesConsignorName() + "'," +
"'Mobile': '" + deliverySetting.getSalesConsignorMobile() + "'," +
"'ProvinceName': '" + consignorAddress[0] + "'," + //省
"'CityName': '" + consignorAddress[1] + "'," + //市
"'ExpAreaName': '" + consignorAddress[2] + "'," + //区
"'Address': '" + storeDeliverGoodsAddressDTO.getSalesConsignorDetail() + "'" + //发件人详细地址
"'Address': '" + deliverySetting.getSalesConsignorDetail() + "'" + //发件人详细地址
"}," +
//收件人信息
"'Receiver': {" +

View File

@@ -172,9 +172,9 @@ public class SeckillApplyServiceImpl extends ServiceImpl<SeckillApplyMapper, Sec
for (SeckillApplyVO seckillApply : seckillApplyList) {
//获取参与活动的商品信息
GoodsSku goodsSku = goodsSkuService.getCanPromotionGoodsSkuByIdFromCache(seckillApply.getSkuId());
if (!goodsSku.getStoreId().equals(storeId)) {
continue;
}
// if (!goodsSku.getStoreId().equals(storeId)) {
// continue;
// }
//获取秒杀活动时间段
DateTime startTime = DateUtil.offsetHour(DateUtil.beginOfDay(seckill.getStartTime()), seckillApply.getTimeLine());
//检测是否可以发布促销商品

View File

@@ -34,7 +34,7 @@ public interface FreightTemplateService extends IService<FreightTemplate> {
* @param storeId
* @return 运费模板列表
*/
List<FreightTemplateVO> getFreightTemplateList(String storeId);
List<FreightTemplateVO> getFreightTemplateList();
/**
* 获取运费模板详细信息

View File

@@ -48,17 +48,15 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
@Override
public List<FreightTemplateVO> getFreightTemplateList(String storeId) {
public List<FreightTemplateVO> getFreightTemplateList() {
//先从缓存中获取运费模板,如果有则直接返回,如果没有则查询数据后再返回
List<FreightTemplateVO> list = (List<FreightTemplateVO>) cache.get(CachePrefix.SHIP_TEMPLATE.getPrefix() + storeId);
List<FreightTemplateVO> list = (List<FreightTemplateVO>) cache.get(CachePrefix.SHIP_TEMPLATE.getPrefix());
if (list != null) {
return list;
}
list = new ArrayList<>();
//查询运费模板
LambdaQueryWrapper<FreightTemplate> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(FreightTemplate::getStoreId, storeId);
List<FreightTemplate> freightTemplates = this.baseMapper.selectList(lambdaQueryWrapper);
List<FreightTemplate> freightTemplates = this.list();
if (!freightTemplates.isEmpty()) {
//如果模板不为空则查询子模板信息
for (FreightTemplate freightTemplate : freightTemplates) {
@@ -71,16 +69,14 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
list.add(freightTemplateVO);
}
}
cache.put(CachePrefix.SHIP_TEMPLATE.getPrefix() + storeId, list);
cache.put(CachePrefix.SHIP_TEMPLATE.getPrefix(), list);
return list;
}
@Override
public IPage<FreightTemplate> getFreightTemplate(PageVO pageVo) {
LambdaQueryWrapper<FreightTemplate> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(FreightTemplate::getStoreId, UserContext.getCurrentUser().getStoreId());
return this.baseMapper.selectPage(PageUtil.initPage(pageVo), lambdaQueryWrapper);
return this.page(PageUtil.initPage(pageVo));
}
@Override
@@ -101,10 +97,7 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
@Override
public FreightTemplateVO addFreightTemplate(FreightTemplateVO freightTemplateVO) {
//获取当前登录商家账号
AuthUser tokenUser = UserContext.getCurrentUser();
FreightTemplate freightTemplate = new FreightTemplate();
//设置店铺ID
freightTemplateVO.setStoreId(tokenUser.getStoreId());
//复制属性
BeanUtils.copyProperties(freightTemplateVO, freightTemplate);
//添加运费模板
@@ -122,7 +115,7 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
}
//更新缓存
cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix() + tokenUser.getStoreId());
cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix());
return freightTemplateVO;
}
@@ -130,10 +123,10 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
@Transactional(rollbackFor = Exception.class)
public FreightTemplateVO editFreightTemplate(FreightTemplateVO freightTemplateVO) {
//获取当前登录商家账号
AuthUser tokenUser = UserContext.getCurrentUser();
if (freightTemplateVO.getId().equals(tokenUser.getStoreId())) {
throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
}
// AuthUser tokenUser = UserContext.getCurrentUser();
// if (freightTemplateVO.getId().equals(tokenUser.getStoreId())) {
// throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR);
// }
FreightTemplate freightTemplate = new FreightTemplate();
//复制属性
BeanUtils.copyProperties(freightTemplateVO, freightTemplate);
@@ -150,7 +143,7 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
//添加模板子内容
freightTemplateChildService.addFreightTemplateChild(list);
//更新缓存
cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix() + tokenUser.getStoreId());
cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix());
return null;
}
@@ -159,13 +152,11 @@ public class FreightTemplateServiceImpl extends ServiceImpl<FreightTemplateMappe
@Transactional(rollbackFor = Exception.class)
public boolean removeFreightTemplate(String id) {
//获取当前登录商家账号
AuthUser tokenUser = UserContext.getCurrentUser();
LambdaQueryWrapper<FreightTemplate> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(FreightTemplate::getStoreId, tokenUser.getStoreId());
lambdaQueryWrapper.eq(FreightTemplate::getId, id);
//如果删除成功则删除运费模板子项
if (this.remove(lambdaQueryWrapper)) {
cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix() + tokenUser.getStoreId());
cache.remove(CachePrefix.SHIP_TEMPLATE.getPrefix());
return freightTemplateChildService.removeFreightTemplate(id);
}
return false;

View File

@@ -1,5 +1,6 @@
package cn.lili.modules.system.entity.dos;
import cn.lili.modules.store.entity.dto.StoreLogisticsCustomerDTO;
import cn.lili.mybatis.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
@@ -37,4 +38,39 @@ public class Logistics extends BaseEntity {
@ApiModelProperty(value = "禁用状态 OPEN开启CLOSE禁用")
private String disabled;
@ApiModelProperty(value = "客户代码")
private String customerName;
@ApiModelProperty(value = "客户密码")
private String customerPwd;
@ApiModelProperty(value = "密钥")
private String monthCode;
@ApiModelProperty(value = "归属网点/网点编码")
private String sendSite;
@ApiModelProperty(value = "收件快递员")
private String sendStaff;
@ApiModelProperty(value = "是否使用电子面单")
private boolean faceSheetFlag;
@ApiModelProperty(value = "支付方式")
private String payType;
@ApiModelProperty(value = "快递类型")
private String expType;
public Logistics(StoreLogisticsCustomerDTO storeLogisticsCustomerDTO){
this.customerName=storeLogisticsCustomerDTO.getCustomerName();
this.customerPwd=storeLogisticsCustomerDTO.getCustomerPwd();
this.sendSite=storeLogisticsCustomerDTO.getSendSite();
this.sendStaff=storeLogisticsCustomerDTO.getSendStaff();
this.monthCode=storeLogisticsCustomerDTO.getMonthCode();
this.faceSheetFlag=storeLogisticsCustomerDTO.isFaceSheetFlag();
this.payType = storeLogisticsCustomerDTO.getPayType();
this.expType = storeLogisticsCustomerDTO.getExpType();
}
}

View File

@@ -0,0 +1,29 @@
package cn.lili.modules.system.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @author chc
* @since 2022/6/2114:46
*/
@Data
public class DeliverySetting implements Serializable {
@ApiModelProperty(value = "发货人姓名")
private String salesConsignorName;
@ApiModelProperty(value = "发货人手机号")
private String salesConsignorMobile;
@ApiModelProperty(value = "地址Id ''分割")
private String salesConsignorAddressId;
@ApiModelProperty(value = "地址名称, ''分割")
private String salesConsignorAddressPath;
@ApiModelProperty(value = "详细地址")
private String salesConsignorDetail;
}

View File

@@ -52,5 +52,7 @@ public enum SettingEnum {
//银联支付设置
UNIONPAY_PAYMENT,
//热词设置
HOT_WORDS
HOT_WORDS,
//发货设置
DELIVERY_SETTING,
}

View File

@@ -102,19 +102,11 @@ public class LogisticsServiceImpl extends ServiceImpl<LogisticsMapper, Logistics
logistics = this.getById(logisticsId);
}
// 店铺-物流公司设置
LambdaQueryWrapper<StoreLogistics> lambdaQueryWrapper = Wrappers.lambdaQuery();
lambdaQueryWrapper.eq(StoreLogistics::getLogisticsId, logistics.getId());
lambdaQueryWrapper.eq(StoreLogistics::getStoreId, order.getStoreId());
StoreLogistics storeLogistics = storeLogisticsService.getOne(lambdaQueryWrapper);
//获取店家信息
StoreDeliverGoodsAddressDTO storeDeliverGoodsAddressDTO = storeDetailService.getStoreDeliverGoodsAddressDto(order.getStoreId());
LabelOrderDTO labelOrderDTO = new LabelOrderDTO();
labelOrderDTO.setOrder(order);
labelOrderDTO.setOrderItems(orderItems);
labelOrderDTO.setLogistics(logistics);
labelOrderDTO.setStoreLogistics(storeLogistics);
labelOrderDTO.setStoreDeliverGoodsAddressDTO(storeDeliverGoodsAddressDTO);
//触发电子面单
return logisticsPluginFactory.filePlugin().labelOrder(labelOrderDTO);
} else {

View File

@@ -1,17 +1,22 @@
package cn.lili.controller.distribution;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.distribution.entity.dos.DistributionGoods;
import cn.lili.modules.distribution.entity.dto.DistributionGoodsSearchParams;
import cn.lili.modules.distribution.entity.vos.DistributionGoodsVO;
import cn.lili.modules.distribution.service.DistributionGoodsService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Objects;
/**
* 管理端,分销商品管理接口
@@ -41,4 +46,13 @@ public class DistributionGoodsManagerController {
distributionGoodsService.removeByIds(ids);
return ResultUtil.success();
}
@ApiOperation(value = "选择商品参与分销")
@ApiImplicitParam(name = "skuId", value = "规格ID", required = true, dataType = "String", paramType = "path")
@PutMapping(value = "/checked/{skuId}")
public ResultMessage<DistributionGoods> distributionCheckGoods(@NotNull(message = "规格ID不能为空") @PathVariable String skuId,
@NotNull(message = "佣金金额不能为空") @RequestParam Double commission) {
return ResultUtil.data(distributionGoodsService.checked(skuId, commission, "-1"));
}
}

View File

@@ -7,7 +7,9 @@ import cn.lili.common.exception.ServiceException;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.Category;
import cn.lili.modules.goods.entity.dto.CategorySearchParams;
import cn.lili.modules.goods.entity.vos.CategoryBrandVO;
import cn.lili.modules.goods.entity.vos.CategoryVO;
import cn.lili.modules.goods.service.CategoryBrandService;
import cn.lili.modules.goods.service.CategoryService;
import cn.lili.modules.goods.service.GoodsService;
import io.swagger.annotations.Api;
@@ -46,6 +48,12 @@ public class CategoryManagerController {
@Autowired
private GoodsService goodsService;
/**
* 分类品牌
*/
@Autowired
private CategoryBrandService categoryBrandService;
@ApiOperation(value = "查询某分类下的全部子分类列表")
@ApiImplicitParam(name = "parentId", value = "父id顶级为0", required = true, dataType = "String", paramType = "path")
@GetMapping(value = "/{parentId}/all-children")
@@ -129,4 +137,13 @@ public class CategoryManagerController {
return ResultUtil.success();
}
@ApiOperation(value = "获取所选分类关联的品牌信息")
@GetMapping(value = "/{categoryId}/brands")
@ApiImplicitParams({
@ApiImplicitParam(name = "categoryId", value = "分类id", required = true, paramType = "path"),
})
public List<CategoryBrandVO> queryBrands(@PathVariable String categoryId) {
return this.categoryBrandService.getCategoryBrandList(categoryId);
}
}

View File

@@ -8,6 +8,7 @@ import cn.lili.common.exception.ServiceException;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.Goods;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.dto.GoodsOperationDTO;
import cn.lili.modules.goods.entity.dto.GoodsSearchParams;
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
@@ -22,6 +23,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.util.Arrays;
import java.util.List;
@@ -119,4 +121,18 @@ public class GoodsManagerController {
return ResultUtil.data(goods);
}
@ApiOperation(value = "新增商品")
@PostMapping(value = "/create", consumes = "application/json", produces = "application/json")
public ResultMessage<GoodsOperationDTO> save(@Valid @RequestBody GoodsOperationDTO goodsOperationDTO) {
goodsService.addGoods(goodsOperationDTO);
return ResultUtil.success();
}
@ApiOperation(value = "修改商品")
@PutMapping(value = "/update/{goodsId}", consumes = "application/json", produces = "application/json")
public ResultMessage<GoodsOperationDTO> update(@Valid @RequestBody GoodsOperationDTO goodsOperationDTO, @PathVariable String goodsId) {
goodsService.editGoods(goodsOperationDTO, goodsId);
return ResultUtil.success();
}
}

View File

@@ -6,6 +6,7 @@ import cn.lili.common.enums.ResultUtil;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.goods.entity.dos.Specification;
import cn.lili.modules.goods.service.CategorySpecificationService;
import cn.lili.modules.goods.service.SpecificationService;
import cn.lili.mybatis.util.PageUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -34,6 +35,9 @@ public class SpecificationManagerController {
@Autowired
private SpecificationService specificationService;
@Autowired
private CategorySpecificationService categorySpecificationService;
@GetMapping("/all")
@ApiOperation(value = "获取所有可用规格")
@@ -56,6 +60,12 @@ public class SpecificationManagerController {
return ResultUtil.success();
}
@GetMapping(value = "/{categoryId}")
@ApiOperation(value = "获取分类规格")
public List<Specification> getSpecifications(@PathVariable String categoryId) {
return categorySpecificationService.getCategorySpecList(categoryId);
}
@PutMapping("/{id}")
@ApiOperation(value = "更改规格")
public ResultMessage<Object> update(@Valid Specification specification, @PathVariable String id) {

View File

@@ -2,6 +2,7 @@ package cn.lili.controller.member;
import cn.lili.common.aop.annotation.PreventDuplicateSubmissions;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.member.entity.dto.EvaluationQueryParams;
@@ -67,4 +68,17 @@ public class MemberEvaluationManagerController {
return ResultUtil.success();
}
@ApiOperation(value = "回复评价")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "评价ID", required = true, dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "reply", value = "回复内容", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "replyImage", value = "回复图片", dataType = "String", paramType = "query")
})
@PutMapping(value = "/reply/{id}")
public ResultMessage<MemberEvaluationVO> reply(@PathVariable String id, @RequestParam String reply, @RequestParam String replyImage) {
OperationalJudgment.judgment(memberEvaluationService.queryById(id));
memberEvaluationService.reply(id, reply, replyImage);
return ResultUtil.success();
}
}

View File

@@ -11,10 +11,13 @@ import cn.lili.modules.member.entity.dto.MemberAddressDTO;
import cn.lili.modules.order.order.entity.dos.Order;
import cn.lili.modules.order.order.entity.dto.OrderExportDTO;
import cn.lili.modules.order.order.entity.dto.OrderSearchParams;
import cn.lili.modules.order.order.entity.dto.PartDeliveryParamsDTO;
import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
import cn.lili.modules.order.order.service.OrderPackageService;
import cn.lili.modules.order.order.service.OrderPriceService;
import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.system.service.LogisticsService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
@@ -49,6 +52,15 @@ public class OrderManagerController {
@Autowired
private OrderPriceService orderPriceService;
@Autowired
private OrderPackageService orderPackageService;
/**
* 快递
*/
@Autowired
private LogisticsService logisticsService;
@ApiOperation(value = "查询订单列表分页")
@GetMapping
@@ -134,4 +146,64 @@ public class OrderManagerController {
orderService.updateSellerRemark(orderSn, sellerRemark);
return ResultUtil.success();
}
@ApiOperation(value = "订单包裹发货")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderSn", value = "订单sn", required = true, dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "logisticsNo", value = "发货单号", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "logisticsId", value = "物流公司", required = true, dataType = "String", paramType = "query")
})
@PostMapping(value = "/{orderSn}/partDelivery")
public ResultMessage<Object> delivery(@RequestBody PartDeliveryParamsDTO partDeliveryParamsDTO) {
return ResultUtil.data(orderService.partDelivery(partDeliveryParamsDTO));
}
@ApiOperation(value = "查看包裹列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path")
})
@GetMapping(value = "/getPackage/{orderSn}")
public ResultMessage<Object> getPackage(@NotBlank(message = "订单编号不能为空") @PathVariable String orderSn) {
return ResultUtil.data(orderPackageService.getOrderPackageVOList(orderSn));
}
@PreventDuplicateSubmissions
@ApiOperation(value = "创建电子面单")
@PostMapping(value = "/{orderSn}/createElectronicsFaceSheet")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderSn", value = "订单号", required = true, paramType = "path"),
@ApiImplicitParam(name = "logisticsId", value = "物流公司", required = true, dataType = "String", paramType = "query")
})
public ResultMessage<Object> createElectronicsFaceSheet(@NotNull(message = "参数非法") @PathVariable String orderSn,
@NotNull(message = "请选择物流公司") String logisticsId) {
return ResultUtil.data(logisticsService.labelOrder(orderSn, logisticsId));
}
@PreventDuplicateSubmissions
@ApiOperation(value = "订单核验")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderSn", value = "订单号", required = true, paramType = "path"),
@ApiImplicitParam(name = "verificationCode", value = "核验码", required = true, paramType = "path")
})
@PutMapping(value = "/take/{orderSn}/{verificationCode}")
public ResultMessage<Object> take(@PathVariable String orderSn, @PathVariable String verificationCode) {
return ResultUtil.data(orderService.take(orderSn, verificationCode));
}
@PreventDuplicateSubmissions
@ApiOperation(value = "订单核验")
@ApiImplicitParams({
@ApiImplicitParam(name = "verificationCode", value = "核验码", required = true, paramType = "path")
})
@PutMapping(value = "/take/{verificationCode}")
public ResultMessage<Object> take(@PathVariable String verificationCode) {
return ResultUtil.data(orderService.take(verificationCode));
}
@ApiOperation(value = "根据核验码获取订单信息")
@ApiImplicitParam(name = "verificationCode", value = "核验码", required = true, paramType = "path")
@GetMapping(value = "/getOrderByVerificationCode/{verificationCode}")
public ResultMessage<Object> getOrderByVerificationCode(@PathVariable String verificationCode) {
return ResultUtil.data(orderService.getOrderByVerificationCode(verificationCode));
}
}

View File

@@ -2,6 +2,9 @@ package cn.lili.controller.promotion;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.AuthUser;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.cart.entity.vo.FullDiscountVO;
@@ -17,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Collections;
import java.util.Objects;
/**
* 管理端,满额活动接口
@@ -56,4 +60,24 @@ public class FullDiscountManagerController {
}
return ResultUtil.error(ResultCode.ERROR);
}
@ApiOperation(value = "新增满优惠活动")
@PostMapping(consumes = "application/json", produces = "application/json")
public ResultMessage<FullDiscount> addFullDiscount(@RequestBody FullDiscountVO fullDiscountVO) {
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
fullDiscountVO.setStoreId("-1");
// fullDiscountVO.setStoreName(currentUser.getStoreName());
if (!fullDiscountService.savePromotions(fullDiscountVO)) {
return ResultUtil.error(ResultCode.PINTUAN_ADD_ERROR);
}
return ResultUtil.data(fullDiscountVO);
}
@ApiOperation(value = "删除满优惠活动")
@DeleteMapping("/{id}")
public ResultMessage<String> deleteFullDiscount(@PathVariable String id) {
OperationalJudgment.judgment(fullDiscountService.getById(id));
fullDiscountService.removePromotions(Collections.singletonList(id));
return ResultUtil.success(ResultCode.FULL_DISCOUNT_EDIT_DELETE);
}
}

View File

@@ -1,9 +1,13 @@
package cn.lili.controller.promotion;
import cn.hutool.core.util.ArrayUtil;
import cn.lili.common.enums.PromotionTypeEnum;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.exception.ServiceException;
import cn.lili.common.security.AuthUser;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.promotion.entity.dos.Pintuan;
@@ -17,9 +21,14 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 管理端,平台拼团接口
@@ -69,4 +78,45 @@ public class PintuanManagerController {
}
@DeleteMapping("/{pintuanId}")
@ApiOperation(value = "手动删除拼团活动")
public ResultMessage<String> deletePintuan(@PathVariable String pintuanId) {
OperationalJudgment.judgment(pintuanService.getById(pintuanId));
if (pintuanService.removePromotions(Collections.singletonList(pintuanId))) {
return ResultUtil.success(ResultCode.PINTUAN_DELETE_SUCCESS);
}
throw new ServiceException(ResultCode.PINTUAN_DELETE_ERROR);
}
@PostMapping(consumes = "application/json", produces = "application/json")
@ApiOperation(value = "添加拼团活动")
public ResultMessage<String> addPintuan(@RequestBody @Validated PintuanVO pintuan) {
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
pintuan.setStoreId(currentUser.getStoreId());
pintuan.setStoreName(currentUser.getStoreName());
if (pintuanService.savePromotions(pintuan)) {
return ResultUtil.success(ResultCode.PINTUAN_ADD_SUCCESS);
}
throw new ServiceException(ResultCode.PINTUAN_ADD_ERROR);
}
@PutMapping(consumes = "application/json", produces = "application/json")
@ApiOperation(value = "修改拼团活动")
public ResultMessage<String> editPintuan(@RequestBody @Validated PintuanVO pintuan) {
OperationalJudgment.judgment(pintuanService.getById(pintuan.getId()));
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
pintuan.setStoreId(currentUser.getStoreId());
pintuan.setStoreName(currentUser.getStoreName());
if (pintuan.getPromotionGoodsList() != null && !pintuan.getPromotionGoodsList().isEmpty()) {
List<String> skuIds = pintuan.getPromotionGoodsList().stream().map(PromotionGoods::getSkuId).collect(Collectors.toList());
pintuan.setScopeId(ArrayUtil.join(skuIds.toArray(), ","));
} else {
pintuan.setScopeId(null);
}
if (pintuanService.updatePromotions(pintuan)) {
return ResultUtil.success(ResultCode.PINTUAN_EDIT_SUCCESS);
}
throw new ServiceException(ResultCode.PINTUAN_EDIT_ERROR);
}
}

View File

@@ -1,11 +1,14 @@
package cn.lili.controller.promotion;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.promotion.entity.dos.Seckill;
import cn.lili.modules.promotion.entity.dos.SeckillApply;
import cn.lili.modules.promotion.entity.dto.search.SeckillSearchParams;
import cn.lili.modules.promotion.entity.vos.SeckillApplyVO;
import cn.lili.modules.promotion.entity.vos.SeckillVO;
import cn.lili.modules.promotion.service.SeckillApplyService;
import cn.lili.modules.promotion.service.SeckillService;
@@ -17,6 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* 管理端,秒杀活动接口
@@ -92,5 +97,11 @@ public class SeckillManagerController {
return ResultUtil.success();
}
@PostMapping(path = "/apply/{seckillId}", consumes = "application/json", produces = "application/json")
@ApiOperation(value = "添加秒杀活动申请")
public ResultMessage<String> addSeckillApply(@PathVariable String seckillId, @RequestBody List<SeckillApplyVO> applyVos) {
seckillApplyService.addSeckillApply(seckillId, "-1", applyVos);
return ResultUtil.success();
}
}

View File

@@ -0,0 +1,69 @@
package cn.lili.controller.setting;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.store.entity.vos.FreightTemplateVO;
import cn.lili.modules.store.service.FreightTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Objects;
/**
* 店铺端,运费模板接口
*
* @author paulG
* @since 2020/8/26
**/
@RestController
@Api(tags = "店铺端,运费模板接口")
@RequestMapping("/manager/setting/freightTemplate")
public class FreightTemplateManagerController {
@Autowired
private FreightTemplateService freightTemplateService;
@ApiOperation(value = "运费模板列表")
@GetMapping
public ResultMessage<List<FreightTemplateVO>> list() {
return ResultUtil.data(freightTemplateService.getFreightTemplateList());
}
@ApiOperation(value = "获取运费模板详情")
@ApiImplicitParam(name = "id", value = "模板ID", required = true, paramType = "path")
@GetMapping("/{id}")
public ResultMessage<FreightTemplateVO> list(@PathVariable String id) {
FreightTemplateVO freightTemplate = OperationalJudgment.judgment(freightTemplateService.getFreightTemplate(id));
return ResultUtil.data(freightTemplate);
}
@ApiOperation(value = "添加运费模板")
@PostMapping
public ResultMessage<FreightTemplateVO> add(@Valid @RequestBody FreightTemplateVO freightTemplateVO) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
freightTemplateVO.setStoreId(storeId);
return ResultUtil.data(freightTemplateService.addFreightTemplate(freightTemplateVO));
}
@ApiOperation(value = "修改运费模板")
@PutMapping("/{id}")
public ResultMessage<FreightTemplateVO> edit(@PathVariable String id, @RequestBody @Valid FreightTemplateVO freightTemplateVO) {
OperationalJudgment.judgment(freightTemplateService.getFreightTemplate(id));
return ResultUtil.data(freightTemplateService.editFreightTemplate(freightTemplateVO));
}
@ApiOperation(value = "删除运费模板")
@ApiImplicitParam(name = "id", value = "模板ID", required = true, paramType = "path")
@DeleteMapping("/{id}")
public ResultMessage<Object> edit(@PathVariable String id) {
OperationalJudgment.judgment(freightTemplateService.getFreightTemplate(id));
freightTemplateService.removeFreightTemplate(id);
return ResultUtil.success();
}
}

View File

@@ -205,6 +205,10 @@ public class SettingManagerController {
return setting == null ?
ResultUtil.data(new HotWordsSetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), HotWordsSetting.class));
case DELIVERY_SETTING:
return setting == null ?
ResultUtil.data(new DeliverySetting()) :
ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), DeliverySetting.class));
default:
throw new ServiceException(ResultCode.SETTING_NOT_TO_SET);
}

View File

@@ -0,0 +1,80 @@
package cn.lili.controller.store;
import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.store.entity.dos.StoreAddress;
import cn.lili.modules.store.service.StoreAddressService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Objects;
/**
* 店铺端,商家地址(自提点)接口
*
* @author Bulbasaur
* @since 2020/11/22 14:23
*/
@RestController
@Api(tags = "商家端,地址(自提点)接口")
@RequestMapping("/manager/store/member/storeAddress")
public class StoreAddressController {
/**
* 店铺自提点
*/
@Autowired
private StoreAddressService storeAddressService;
@ApiOperation(value = "获取商家自提点分页")
@GetMapping
public ResultMessage<IPage<StoreAddress>> get(PageVO pageVo) {
return ResultUtil.data(storeAddressService.getStoreAddress("-1", pageVo));
}
@ApiOperation(value = "获取商家自提点信息")
@ApiImplicitParam(name = "id", value = "自提点ID", required = true, paramType = "path")
@GetMapping("/{id}")
public ResultMessage<StoreAddress> get(@PathVariable String id) {
StoreAddress address = OperationalJudgment.judgment(storeAddressService.getById(id));
return ResultUtil.data(address);
}
@ApiOperation(value = "添加")
@PostMapping
public ResultMessage<StoreAddress> add(@Valid StoreAddress storeAddress) {
storeAddress.setStoreId("-1");
storeAddressService.save(storeAddress);
return ResultUtil.data(storeAddress);
}
@ApiOperation(value = "编辑")
@ApiImplicitParam(name = "id", value = "自提点ID", required = true, paramType = "path")
@PutMapping("/{id}")
public ResultMessage<StoreAddress> edit(@PathVariable String id, @Valid StoreAddress storeAddress) {
OperationalJudgment.judgment(storeAddressService.getById(id));
storeAddress.setId(id);
storeAddress.setStoreId("-1");
storeAddressService.updateById(storeAddress);
return ResultUtil.data(storeAddress);
}
@ApiOperation(value = "删除")
@ApiImplicitParam(name = "id", value = "自提点ID", required = true, paramType = "path")
@DeleteMapping(value = "/{id}")
public ResultMessage<Object> delByIds(@PathVariable String id) {
OperationalJudgment.judgment(storeAddressService.getById(id));
storeAddressService.removeStoreAddress(id);
return ResultUtil.success();
}
}

View File

@@ -33,7 +33,7 @@ public class FreightTemplateStoreController {
@GetMapping
public ResultMessage<List<FreightTemplateVO>> list() {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
return ResultUtil.data(freightTemplateService.getFreightTemplateList(storeId));
return ResultUtil.data(freightTemplateService.getFreightTemplateList());
}
@ApiOperation(value = "获取商家运费模板详情")