From 64e45c10b1f097d381f6a0b24b17ab6adefc657d Mon Sep 17 00:00:00 2001 From: lifenlong Date: Wed, 11 Aug 2021 20:14:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BA=97=E9=93=BA?= =?UTF-8?q?=E4=BC=81=E4=B8=9A=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=A0=E9=99=A4=E5=95=86=E5=93=81=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E4=BF=AE=E6=94=B9=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E9=87=91=E9=A2=9D=E5=94=AE=E5=90=8E=E9=87=91=E9=A2=9D=E4=B8=8D?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../store/StoreBuyerController.java | 7 ++ .../controller/common/UploadController.java | 2 +- .../order/entity/dto/PriceDetailDTO.java | 2 +- .../serviceimpl/AfterSaleServiceImpl.java | 2 +- .../serviceimpl/OrderPriceServiceImpl.java | 12 ++- .../service/SeckillApplyService.java | 6 +- .../serviceimpl/SeckillApplyServiceImpl.java | 73 ++++++------------- .../store/entity/vos/StoreOtherVO.java | 32 ++++++++ .../store/mapper/StoreDetailMapper.java | 9 +++ .../store/service/StoreDetailService.java | 9 +++ .../serviceimpl/StoreDetailServiceImpl.java | 8 ++ .../promotion/SeckillManagerController.java | 8 ++ .../promotion/SeckillStoreController.java | 13 ++-- 13 files changed, 118 insertions(+), 65 deletions(-) create mode 100644 framework/src/main/java/cn/lili/modules/store/entity/vos/StoreOtherVO.java diff --git a/buyer-api/src/main/java/cn/lili/controller/store/StoreBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/store/StoreBuyerController.java index c3d824d4..274a00d2 100644 --- a/buyer-api/src/main/java/cn/lili/controller/store/StoreBuyerController.java +++ b/buyer-api/src/main/java/cn/lili/controller/store/StoreBuyerController.java @@ -63,6 +63,13 @@ public class StoreBuyerController { return ResultUtil.data(storeDetailService.getStoreBasicInfoDTO(id)); } + @ApiOperation(value = "通过id获取店铺详细信息-营业执照") + @ApiImplicitParam(name = "id", value = "店铺ID", required = true, paramType = "path") + @GetMapping(value = "/get/licencePhoto/{id}") + public ResultMessage licencePhoto(@NotNull @PathVariable String id) { + return ResultUtil.data(storeDetailService.getStoreOtherVO(id)); + } + @ApiOperation(value = "通过id获取店铺商品分类") @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "店铺ID", required = true, paramType = "path") diff --git a/common-api/src/main/java/cn/lili/controller/common/UploadController.java b/common-api/src/main/java/cn/lili/controller/common/UploadController.java index 82003a58..d57c2d7a 100644 --- a/common-api/src/main/java/cn/lili/controller/common/UploadController.java +++ b/common-api/src/main/java/cn/lili/controller/common/UploadController.java @@ -68,7 +68,7 @@ public class UploadController { throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR); } Setting setting = settingService.get(SettingEnum.OSS_SETTING.name()); - if (setting == null || StrUtil.isBlank(setting.getSettingValue())) { + if (StrUtil.isEmpty(setting.getSettingValue())) { throw new ServiceException(ResultCode.OSS_NOT_EXIST); } diff --git a/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java b/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java index ff8a396b..562bbceb 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java +++ b/framework/src/main/java/cn/lili/modules/order/order/entity/dto/PriceDetailDTO.java @@ -96,7 +96,7 @@ public class PriceDetailDTO implements Serializable { public Double getOriginalPrice() { - if (originalPrice == null) { + if (originalPrice == 0D) { return flowPrice; } return originalPrice; diff --git a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java index 7beb0b53..ece06cbc 100644 --- a/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/order/order/serviceimpl/AfterSaleServiceImpl.java @@ -189,7 +189,7 @@ public class AfterSaleServiceImpl extends ServiceImpl orderItems = updateOrderItemPrice(order); //这里如果直接赋予订单金额,则累加可能会出现小数点,最后无法累加回去,所以用一个零时变量累加后,将平台佣金赋予对象 @@ -150,6 +154,9 @@ public class OrderPriceServiceImpl implements OrderPriceService { //获取订单货物价格信息 PriceDetailDTO priceDetailDTO = orderItem.getPriceDetailDTO(); + if (priceDetailDTO.getOriginalPrice() == 0D) { + priceDetailDTO.setOriginalPrice(priceDetailDTO.getFlowPrice()); + } //SKU占总订单 金额的百分比 Double priceFluctuationRatio = CurrencyUtil.div(priceDetailDTO.getOriginalPrice(), order.getPriceDetailDTO().getOriginalPrice()); @@ -161,13 +168,14 @@ public class OrderPriceServiceImpl implements OrderPriceService { priceDetailDTO.setFlowPrice(flowPrice); + //计算平台佣金=交易金额*分类佣金比例/100 Double platFormCommission = CurrencyUtil.div(CurrencyUtil.mul(flowPrice, categoryService.getById(orderItem.getCategoryId()).getCommissionRate()), 100); priceDetailDTO.setPlatFormCommission(platFormCommission); //修改订单货物金额 orderItem.setFlowPrice(flowPrice); - + orderItem.setUnitPrice(CurrencyUtil.div(flowPrice,orderItem.getNum())); priceDetailDTO.countBill(); orderItem.setPriceDetail(JSONUtil.toJsonStr(priceDetailDTO)); orderItemService.update(orderItem, new LambdaUpdateWrapper().eq(OrderItem::getId, orderItem.getId())); diff --git a/framework/src/main/java/cn/lili/modules/promotion/service/SeckillApplyService.java b/framework/src/main/java/cn/lili/modules/promotion/service/SeckillApplyService.java index d83b0cbb..928bb00c 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/service/SeckillApplyService.java +++ b/framework/src/main/java/cn/lili/modules/promotion/service/SeckillApplyService.java @@ -57,10 +57,10 @@ public interface SeckillApplyService extends IService { void addSeckillApply(String seckillId, String storeId, List seckillApplyList); /** - * 批量删除秒杀活动申请 + * 批量删除秒杀活动商品 * * @param seckillId 秒杀活动活动id - * @param ids 秒杀活动申请id集合 + * @param id 秒杀活动商品 */ - void removeSeckillApplyByIds(String seckillId, List ids); + void removeSeckillApply(String seckillId, String id ); } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillApplyServiceImpl.java b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillApplyServiceImpl.java index bc2b1b0d..d67008d5 100644 --- a/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillApplyServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/promotion/serviceimpl/SeckillApplyServiceImpl.java @@ -25,6 +25,7 @@ import cn.lili.modules.promotion.service.SeckillApplyService; import cn.lili.modules.promotion.service.SeckillService; import cn.lili.modules.promotion.tools.PromotionCacheKeys; import cn.lili.modules.promotion.tools.PromotionTools; +import cn.lili.modules.search.service.EsGoodsIndexService; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -74,6 +75,11 @@ public class SeckillApplyServiceImpl extends ServiceImpl getSeckillTimeline() { @@ -201,20 +207,31 @@ public class SeckillApplyServiceImpl extends ServiceImpl ids) { + public void removeSeckillApply(String seckillId, String id) { SeckillVO seckillVO = this.mongoTemplate.findById(seckillId, SeckillVO.class); if (seckillVO == null) { throw new ServiceException(ResultCode.SECKILL_NOT_EXIST_ERROR); } - if (seckillVO.getPromotionStatus().equals(PromotionStatusEnum.START.name())) { - throw new ServiceException(ResultCode.SECKILL_UPDATE_ERROR); - } - seckillVO.getSeckillApplyList().removeIf(seckillApply -> ids.contains(seckillApply.getId())); + SeckillApply seckillApply = this.getById(id); + //获取商品SKUID + String skuId = seckillApply.getSkuId(); + + //清除秒杀活动中的商品 + seckillVO.getSeckillApplyList().removeIf(seckillApply1 -> id.contains(seckillApply1.getId())); this.mongoTemplate.save(seckillVO); - this.removeByIds(ids); + + //删除促销商品 + this.removeById(id); + + //清除索引 + this.goodsIndexService.deleteEsGoodsPromotionByPromotionId(skuId, seckillId); + //删除促销商品 + promotionGoodsService.remove(new LambdaQueryWrapper() + .eq(PromotionGoods::getSkuId, skuId) + .eq(PromotionGoods::getPromotionType, PromotionTypeEnum.SECKILL.name())); } /** @@ -247,48 +264,6 @@ public class SeckillApplyServiceImpl extends ServiceImpl hash = cache.getHash(seckillCacheKey); - //如果缓存中存在当前审核商品参与的秒杀活动活动商品信息,清除 - if (hash != null && !hash.isEmpty()) { - cache.remove(seckillCacheKey); - } - } - /** * 从缓存中获取秒杀活动信息 * diff --git a/framework/src/main/java/cn/lili/modules/store/entity/vos/StoreOtherVO.java b/framework/src/main/java/cn/lili/modules/store/entity/vos/StoreOtherVO.java new file mode 100644 index 00000000..a6956f3d --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/store/entity/vos/StoreOtherVO.java @@ -0,0 +1,32 @@ +package cn.lili.modules.store.entity.vos; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * 店铺其他信息 + * @author Bulbasaur + * @date: 2021/8/11 3:42 下午 + * + */ +@Data +public class StoreOtherVO { + + @ApiModelProperty(value = "公司名称") + private String companyName; + + @ApiModelProperty(value = "公司地址") + private String companyAddress; + + @ApiModelProperty(value = "公司地址地区") + private String companyAddressPath; + + @ApiModelProperty(value = "营业执照电子版") + private String licencePhoto; + + @ApiModelProperty(value = "法定经营范围") + private String scope; + + @ApiModelProperty(value = "员工总数") + private Integer employeeNum; +} diff --git a/framework/src/main/java/cn/lili/modules/store/mapper/StoreDetailMapper.java b/framework/src/main/java/cn/lili/modules/store/mapper/StoreDetailMapper.java index 39f827f9..e2b3fe7b 100644 --- a/framework/src/main/java/cn/lili/modules/store/mapper/StoreDetailMapper.java +++ b/framework/src/main/java/cn/lili/modules/store/mapper/StoreDetailMapper.java @@ -6,6 +6,7 @@ import cn.lili.modules.store.entity.dto.StoreAfterSaleAddressDTO; import cn.lili.modules.store.entity.dto.StoreSettlementDay; import cn.lili.modules.store.entity.vos.StoreBasicInfoVO; import cn.lili.modules.store.entity.vos.StoreDetailVO; +import cn.lili.modules.store.entity.vos.StoreOtherVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; @@ -79,4 +80,12 @@ public interface StoreDetailMapper extends BaseMapper { */ @Update("UPDATE li_store_detail SET settlement_day=#{dateTime} WHERE store_id=#{storeId}") void updateSettlementDay(String storeId, DateTime dateTime); + + /** + * 查看店铺营业执照信息 + * @param storeId 店铺ID + * @return 店铺营业执照 + */ + @Select("SELECT * FROM li_store_detail WHERE store_id=#{storeId}") + StoreOtherVO getLicencePhoto(String storeId); } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/store/service/StoreDetailService.java b/framework/src/main/java/cn/lili/modules/store/service/StoreDetailService.java index dd2c518e..cf7c311c 100644 --- a/framework/src/main/java/cn/lili/modules/store/service/StoreDetailService.java +++ b/framework/src/main/java/cn/lili/modules/store/service/StoreDetailService.java @@ -5,6 +5,7 @@ import cn.lili.modules.store.entity.dto.StoreAfterSaleAddressDTO; import cn.lili.modules.store.entity.dto.StoreSettingDTO; import cn.lili.modules.store.entity.vos.StoreBasicInfoVO; import cn.lili.modules.store.entity.vos.StoreDetailVO; +import cn.lili.modules.store.entity.vos.StoreOtherVO; import com.baomidou.mybatisplus.extension.service.IService; import java.util.List; @@ -95,4 +96,12 @@ public interface StoreDetailService extends IService { * @return 店铺经营范围 */ List goodsManagementCategory(String storeId); + + /** + * 获取店铺其他信息 + * + * @param storeId 店铺ID + * @return 店铺其他信息 + */ + StoreOtherVO getStoreOtherVO(String storeId); } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreDetailServiceImpl.java b/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreDetailServiceImpl.java index a8b54127..7b888c43 100644 --- a/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreDetailServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreDetailServiceImpl.java @@ -12,6 +12,7 @@ import cn.lili.modules.store.entity.dto.StoreSettingDTO; import cn.lili.modules.store.entity.vos.StoreBasicInfoVO; import cn.lili.modules.store.entity.vos.StoreDetailVO; import cn.lili.modules.store.entity.vos.StoreManagementCategoryVO; +import cn.lili.modules.store.entity.vos.StoreOtherVO; import cn.lili.modules.store.mapper.StoreDetailMapper; import cn.lili.modules.store.service.StoreDetailService; import cn.lili.modules.store.service.StoreService; @@ -134,4 +135,11 @@ public class StoreDetailServiceImpl extends ServiceImpl deleteSeckillApply(@PathVariable String seckillId, @PathVariable String id) { + seckillApplyService.removeSeckillApply(seckillId, id); + return ResultUtil.success(); + } + + } diff --git a/seller-api/src/main/java/cn/lili/controller/promotion/SeckillStoreController.java b/seller-api/src/main/java/cn/lili/controller/promotion/SeckillStoreController.java index 010ae363..9a9e2b50 100644 --- a/seller-api/src/main/java/cn/lili/controller/promotion/SeckillStoreController.java +++ b/seller-api/src/main/java/cn/lili/controller/promotion/SeckillStoreController.java @@ -1,8 +1,7 @@ package cn.lili.controller.promotion; -import cn.lili.common.enums.ResultCode; -import cn.lili.common.security.context.UserContext; import cn.lili.common.enums.ResultUtil; +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; @@ -18,7 +17,6 @@ import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.util.Arrays; import java.util.List; /** @@ -72,11 +70,10 @@ public class SeckillStoreController { return ResultUtil.success(); } - @DeleteMapping("/apply/{seckillId}/{ids}") - @ApiOperation(value = "删除秒杀活动申请") - public ResultMessage deleteSeckillApply(@PathVariable("seckillId") String seckillId, @PathVariable("ids") String ids) { - String[] idsSplit = ids.split(","); - seckillApplyService.removeSeckillApplyByIds(seckillId, Arrays.asList(idsSplit)); + @DeleteMapping("/apply/{seckillId}/{id}") + @ApiOperation(value = "删除秒杀活动商品") + public ResultMessage deleteSeckillApply(@PathVariable String seckillId,@PathVariable String id) { + seckillApplyService.removeSeckillApply(seckillId, id); return ResultUtil.success(); } From 38124a702a8781171761647a7c81e68340b5888c Mon Sep 17 00:00:00 2001 From: lifenlong Date: Wed, 11 Aug 2021 21:12:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=88=86=E7=B1=BB=E5=8E=BB=E9=99=A4?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=BF=85=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/common/UploadController.java | 2 +- .../lili/modules/goods/entity/dos/Category.java | 1 - .../store/entity/dto/StoreCompanyDTO.java | 14 ++++---------- .../store/entity/dto/StoreOtherInfoDTO.java | 12 ++++++++++++ .../store/serviceimpl/StoreServiceImpl.java | 17 +++++++++-------- 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/common-api/src/main/java/cn/lili/controller/common/UploadController.java b/common-api/src/main/java/cn/lili/controller/common/UploadController.java index d57c2d7a..82003a58 100644 --- a/common-api/src/main/java/cn/lili/controller/common/UploadController.java +++ b/common-api/src/main/java/cn/lili/controller/common/UploadController.java @@ -68,7 +68,7 @@ public class UploadController { throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR); } Setting setting = settingService.get(SettingEnum.OSS_SETTING.name()); - if (StrUtil.isEmpty(setting.getSettingValue())) { + if (setting == null || StrUtil.isBlank(setting.getSettingValue())) { throw new ServiceException(ResultCode.OSS_NOT_EXIST); } diff --git a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Category.java b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Category.java index 4dc0933e..d35e73df 100644 --- a/framework/src/main/java/cn/lili/modules/goods/entity/dos/Category.java +++ b/framework/src/main/java/cn/lili/modules/goods/entity/dos/Category.java @@ -52,7 +52,6 @@ public class Category extends BaseEntity { @ApiModelProperty(value = "佣金比例") private Double commissionRate; - @NotEmpty(message = "分类图标不能为空") @ApiModelProperty(value = "分类图标") private String image; diff --git a/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreCompanyDTO.java b/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreCompanyDTO.java index 022538bb..c6761160 100644 --- a/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreCompanyDTO.java +++ b/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreCompanyDTO.java @@ -23,17 +23,11 @@ public class StoreCompanyDTO { @ApiModelProperty(value = "公司名称") private String companyName; - @NotBlank(message = "地址不能为空") - @ApiModelProperty(value = "地址名称, ','分割") - private String storeAddressPath; + @ApiModelProperty(value = "公司地址地区Id") + private String companyAddressIdPath; - @NotBlank(message = "地址ID不能为空") - @ApiModelProperty(value = "地址id,','分割 ") - private String storeAddressIdPath; - - @NotBlank(message = "地址详情") - @ApiModelProperty(value = "地址详情") - private String storeAddressDetail; + @ApiModelProperty(value = "公司地址地区") + private String companyAddressPath; @Size(min = 1, max = 200) @NotBlank(message = "公司地址不能为空") diff --git a/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreOtherInfoDTO.java b/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreOtherInfoDTO.java index ab6caa35..08d35795 100644 --- a/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreOtherInfoDTO.java +++ b/framework/src/main/java/cn/lili/modules/store/entity/dto/StoreOtherInfoDTO.java @@ -37,4 +37,16 @@ public class StoreOtherInfoDTO { @ApiModelProperty(value = "店铺经营类目") private String goodsManagementCategory; + @NotBlank(message = "地址不能为空") + @ApiModelProperty(value = "地址名称, ','分割") + private String storeAddressPath; + + @NotBlank(message = "地址ID不能为空") + @ApiModelProperty(value = "地址id,','分割 ") + private String storeAddressIdPath; + + @NotBlank(message = "地址详情") + @ApiModelProperty(value = "地址详情") + private String storeAddressDetail; + } diff --git a/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreServiceImpl.java b/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreServiceImpl.java index 60614ced..2e78ed5a 100644 --- a/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/store/serviceimpl/StoreServiceImpl.java @@ -239,15 +239,13 @@ public class StoreServiceImpl extends ServiceImpl implements BeanUtil.copyProperties(storeCompanyDTO, storeDetail); return storeDetailService.save(storeDetail); } else { - store.setStoreAddressDetail(storeCompanyDTO.getStoreAddressDetail()); - store.setStoreAddressIdPath(storeCompanyDTO.getStoreAddressIdPath()); - store.setStoreAddressPath(storeCompanyDTO.getStoreAddressPath()); - this.saveOrUpdate(store); + BeanUtil.copyProperties(storeCompanyDTO, store); + this.updateById(store); + //判断是否存在店铺详情,如果没有则进行新建,如果存在则进行修改 + StoreDetail storeDetail = storeDetailService.getStoreDetail(store.getId()); + BeanUtil.copyProperties(storeCompanyDTO, storeDetail); + return storeDetailService.updateById(storeDetail); } - //判断是否存在店铺详情,如果没有则进行新建,如果存在则进行修改 - StoreDetail storeDetail = storeDetailService.getStoreDetail(store.getId()); - BeanUtil.copyProperties(storeCompanyDTO, storeDetail); - return storeDetailService.updateById(storeDetail); } @Override @@ -265,6 +263,9 @@ public class StoreServiceImpl extends ServiceImpl implements public boolean applyThirdStep(StoreOtherInfoDTO storeOtherInfoDTO) { //获取当前操作的店铺 Store store = getStoreByMember(); + BeanUtil.copyProperties(storeOtherInfoDTO, store); + this.updateById(store); + StoreDetail storeDetail = storeDetailService.getStoreDetail(store.getId()); //设置店铺的其他信息 BeanUtil.copyProperties(storeOtherInfoDTO, storeDetail);