From dfb98c107ed55a20afccf404b4373f4ffd11a362 Mon Sep 17 00:00:00 2001 From: chc <1501738723@qq.com> Date: Mon, 21 Oct 2024 22:34:23 +0800 Subject: [PATCH] =?UTF-8?q?B2C=E5=8A=9F=E8=83=BD=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DB/b2c.sql | 11 ++ .../other/SettingBuyerController.java | 168 ++++++++++++++++++ .../modules/goods/service/GoodsService.java | 23 --- .../goods/serviceimpl/GoodsServiceImpl.java | 54 +----- .../store/serviceimpl/StoreServiceImpl.java | 4 - .../modules/system/entity/dos/Logistics.java | 10 -- .../modules/system/entity/dto/ImSetting.java | 10 +- .../entity/dto/LogisticsSearchParams.java | 25 +++ .../goods/DraftGoodsManagerController.java | 65 +++++++ .../goods/GoodsManagerController.java | 39 ++++ .../order/AfterSaleManagerController.java | 15 ++ .../other/LogisticsManagerController.java | 6 +- .../FullDiscountManagerController.java | 13 ++ 13 files changed, 351 insertions(+), 92 deletions(-) create mode 100644 DB/b2c.sql create mode 100644 buyer-api/src/main/java/cn/lili/controller/other/SettingBuyerController.java create mode 100644 framework/src/main/java/cn/lili/modules/system/entity/dto/LogisticsSearchParams.java create mode 100644 manager-api/src/main/java/cn/lili/controller/goods/DraftGoodsManagerController.java diff --git a/DB/b2c.sql b/DB/b2c.sql new file mode 100644 index 000000000..a81524a5a --- /dev/null +++ b/DB/b2c.sql @@ -0,0 +1,11 @@ +/** + 物流公司增加电子面单参数 + */ +ALTER TABLE li_logistics ADD `customer_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '客户代码'; +ALTER TABLE li_logistics ADD `customer_pwd` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '客户密码'; +ALTER TABLE li_logistics ADD `month_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '月结号/密钥'; +ALTER TABLE li_logistics ADD `send_site` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '归属网点'; +ALTER TABLE li_logistics ADD `send_staff` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '收件快递员'; +ALTER TABLE li_logistics ADD `face_sheet_flag` bit(1) DEFAULT NULL COMMENT '是否使用电子面单'; +ALTER TABLE li_logistics ADD `pay_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '支付方式'; +ALTER TABLE li_logistics ADD `exp_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL COMMENT '快递类型'; diff --git a/buyer-api/src/main/java/cn/lili/controller/other/SettingBuyerController.java b/buyer-api/src/main/java/cn/lili/controller/other/SettingBuyerController.java new file mode 100644 index 000000000..fab6ffdc2 --- /dev/null +++ b/buyer-api/src/main/java/cn/lili/controller/other/SettingBuyerController.java @@ -0,0 +1,168 @@ +package cn.lili.controller.other; + +import cn.hutool.json.JSONUtil; +import cn.lili.cache.Cache; +import cn.lili.common.aop.annotation.DemoSite; +import cn.lili.common.enums.ResultCode; +import cn.lili.common.enums.ResultUtil; +import cn.lili.common.exception.ServiceException; +import cn.lili.common.vo.ResultMessage; +import cn.lili.modules.system.entity.dos.Setting; +import cn.lili.modules.system.entity.dto.*; +import cn.lili.modules.system.entity.dto.connect.ConnectSetting; +import cn.lili.modules.system.entity.dto.connect.QQConnectSetting; +import cn.lili.modules.system.entity.dto.connect.WechatConnectSetting; +import cn.lili.modules.system.entity.dto.payment.AlipayPaymentSetting; +import cn.lili.modules.system.entity.dto.payment.PaymentSupportSetting; +import cn.lili.modules.system.entity.dto.payment.UnionPaymentSetting; +import cn.lili.modules.system.entity.dto.payment.WechatPaymentSetting; +import cn.lili.modules.system.entity.dto.payment.dto.PaymentSupportForm; +import cn.lili.modules.system.entity.enums.SettingEnum; +import cn.lili.modules.system.service.SettingService; +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.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author chc + * @since 2022/6/2114:46 + */ +@RestController +@Api(tags = "买家端,系统设置") +@RequestMapping("/buyer/other/setting") +public class SettingBuyerController { + + @Autowired + private SettingService settingService; + /** + * 缓存 + */ + @Autowired + private Cache cache; + + @DemoSite + @ApiOperation(value = "查看配置") + @GetMapping(value = "/get/{key}") + @ApiImplicitParam(name = "key", value = "配置key", paramType = "path" + , allowableValues = "BASE_SETTING,EMAIL_SETTING,GOODS_SETTING,KUAIDI_SETTING,ORDER_SETTING,OSS_SETTING,POINT_SETTING," + + "WECHAT_PC_CONNECT,WECHAT_WAP_CONNECT,WECHAT_APP_CONNECT,WECHAT_MP_CONNECT," + + "QQ_WEB_CONNECT,QQ_APP_CONNECT," + + "QQ_WEB_CONNECT,QQ_APP_CONNECT,WEIBO_CONNECT,ALIPAY_CONNECT," + + "PAYMENT_SUPPORT,ALIPAY_PAYMENT,WECHAT_PAYMENT,SECKILL_SETTING,EXPERIENCE_SETTING,IM" + ) + public ResultMessage settingGet(@PathVariable String key) { + return createSetting(key); + } + + /** + * 获取表单 + * 这里主要包含一个配置对象为空,导致转换异常问题的处理,解决配置项增加减少,带来的系统异常,无法直接配置 + * + * @param key + * @return + * @throws InstantiationException + * @throws IllegalAccessException + */ + private ResultMessage createSetting(String key) { + SettingEnum settingEnum = SettingEnum.valueOf(key); + cache.remove(key); + Setting setting = settingService.get(key); + switch (settingEnum) { + case BASE_SETTING: + return setting == null ? + ResultUtil.data(new BaseSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), BaseSetting.class)); + case WITHDRAWAL_SETTING: + return setting == null ? + ResultUtil.data(new WithdrawalSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), WithdrawalSetting.class)); + case DISTRIBUTION_SETTING: + return setting == null ? + ResultUtil.data(new DistributionSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), DistributionSetting.class)); + case EMAIL_SETTING: + return setting == null ? + ResultUtil.data(new EmailSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), EmailSetting.class)); + case GOODS_SETTING: + return setting == null ? + ResultUtil.data(new GoodsSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), GoodsSetting.class)); + case LOGISTICS_SETTING: + return setting == null ? + ResultUtil.data(new LogisticsSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), LogisticsSetting.class)); + case ORDER_SETTING: + return setting == null ? + ResultUtil.data(new OrderSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), OrderSetting.class)); + case OSS_SETTING: + return setting == null ? + ResultUtil.data(new OssSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), OssSetting.class)); + case SMS_SETTING: + return setting == null ? + ResultUtil.data(new SmsSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), SmsSetting.class)); + case POINT_SETTING: + return setting == null ? + ResultUtil.data(new PointSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), PointSetting.class)); + case QQ_CONNECT: + return setting == null ? + ResultUtil.data(new QQConnectSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), QQConnectSetting.class)); + case CONNECT_SETTING: + return setting == null ? + ResultUtil.data(new ConnectSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), ConnectSetting.class)); + case PAYMENT_SUPPORT: + return setting == null ? + ResultUtil.data(new PaymentSupportSetting(new PaymentSupportForm())) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), PaymentSupportSetting.class)); + case ALIPAY_PAYMENT: + return setting == null ? + ResultUtil.data(new AlipayPaymentSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), AlipayPaymentSetting.class)); + case UNIONPAY_PAYMENT: + return setting == null ? + ResultUtil.data(new UnionPaymentSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), UnionPaymentSetting.class)); + case WECHAT_CONNECT: + return setting == null ? + ResultUtil.data(new WechatConnectSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), WechatConnectSetting.class)); + case WECHAT_PAYMENT: + return setting == null ? + ResultUtil.data(new WechatPaymentSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), WechatPaymentSetting.class)); + case SECKILL_SETTING: + return setting == null ? + ResultUtil.data(new SeckillSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), SeckillSetting.class)); + case EXPERIENCE_SETTING: + return setting == null ? + ResultUtil.data(new ExperienceSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), ExperienceSetting.class)); + case IM_SETTING: + return setting == null ? + ResultUtil.data(new ImSetting()) : + ResultUtil.data(JSONUtil.toBean(setting.getSettingValue(), ImSetting.class)); + case HOT_WORDS: + 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); + } + } +} diff --git a/framework/src/main/java/cn/lili/modules/goods/service/GoodsService.java b/framework/src/main/java/cn/lili/modules/goods/service/GoodsService.java index ee92e1d51..81ad11889 100644 --- a/framework/src/main/java/cn/lili/modules/goods/service/GoodsService.java +++ b/framework/src/main/java/cn/lili/modules/goods/service/GoodsService.java @@ -28,13 +28,6 @@ public interface GoodsService extends IService { */ List getByBrandIds(List brandIds); - /** - * 下架所有商家商品 - * - * @param storeId 店铺ID - */ - void underStoreGoods(String storeId); - /** * 更新商品参数 * @@ -113,16 +106,6 @@ public interface GoodsService extends IService { Boolean updateGoodsMarketAble(List goodsIds, GoodsStatusEnum goodsStatusEnum, String underReason); - /** - * 更新商品上架状态状态 - * - * @param storeId 店铺ID - * @param goodsStatusEnum 更新的商品状态 - * @param underReason 下架原因 - * @return 更新结果 - */ - Boolean updateGoodsMarketAbleByStoreId(String storeId, GoodsStatusEnum goodsStatusEnum, String underReason); - /** * 更新商品上架状态状态 * @@ -177,12 +160,6 @@ public interface GoodsService extends IService { * @param store */ void updateStoreDetail(Store store); - /** - * 统计店铺的商品数量 - * @param storeId 店铺id - * @return - */ - long countStoreGoodsNum(String storeId); /** * 同步商品分类名称 diff --git a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java index 8f86854b2..85ad1a067 100644 --- a/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/goods/serviceimpl/GoodsServiceImpl.java @@ -129,19 +129,6 @@ public class GoodsServiceImpl extends ServiceImpl implements return list(lambdaQueryWrapper); } - @Override - @Transactional(rollbackFor = Exception.class) - public void underStoreGoods(String storeId) { - //获取商品ID列表 - List list = this.baseMapper.getGoodsIdByStoreId(storeId); - //下架店铺下的商品 - this.updateGoodsMarketAbleByStoreId(storeId, GoodsStatusEnum.DOWN, "店铺关闭"); - - applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("下架商品", - rocketmqCustomProperties.getGoodsTopic(), GoodsTagsEnum.DOWN.name(), JSONUtil.toJsonStr(list))); - - } - /** * 更新商品参数 * @@ -340,29 +327,6 @@ public class GoodsServiceImpl extends ServiceImpl implements return result; } - /** - * 更新商品上架状态状态 - * - * @param storeId 店铺ID - * @param goodsStatusEnum 更新的商品状态 - * @param underReason 下架原因 - * @return 更新结果 - */ - @Override - @SystemLogPoint(description = "店铺关闭下架商品", customerLog = "'操作类型:['+#goodsStatusEnum+'],操作对象:['+#storeId+'],操作原因:['+#underReason+']'") - public Boolean updateGoodsMarketAbleByStoreId(String storeId, GoodsStatusEnum goodsStatusEnum, String underReason) { - - - LambdaUpdateWrapper updateWrapper = this.getUpdateWrapperByStoreAuthority(); - updateWrapper.set(Goods::getMarketEnable, goodsStatusEnum.name()); - updateWrapper.set(Goods::getUnderMessage, underReason); - updateWrapper.eq(Goods::getStoreId, storeId); - boolean result = this.update(updateWrapper); - - //修改规格商品 - this.goodsSkuService.updateGoodsSkuStatusByStoreId(storeId, goodsStatusEnum.name(), null); - return result; - } @Override @SystemLogPoint(description = "管理员关闭下架商品", customerLog = "'操作类型:['+#goodsStatusEnum+'],操作对象:['+#goodsIds+'],操作原因:['+#underReason+']'") @@ -430,7 +394,7 @@ public class GoodsServiceImpl extends ServiceImpl implements if (freightTemplate == null) { throw new ServiceException(ResultCode.FREIGHT_TEMPLATE_NOT_EXIST); } - if (authUser != null && !freightTemplate.getStoreId().equals(authUser.getStoreId())) { + if (authUser != null) { throw new ServiceException(ResultCode.USER_AUTHORITY_ERROR); } LambdaUpdateWrapper lambdaUpdateWrapper = Wrappers.lambdaUpdate(); @@ -517,16 +481,6 @@ public class GoodsServiceImpl extends ServiceImpl implements goodsSkuService.update(updateWrapper); } - @Override - public long countStoreGoodsNum(String storeId) { - return this.count( - new LambdaQueryWrapper() - .eq(Goods::getStoreId, storeId) - .eq(Goods::getDeleteFlag, Boolean.FALSE) - .eq(Goods::getAuthFlag, GoodsAuthEnum.PASS.name()) - .eq(Goods::getMarketEnable, GoodsStatusEnum.UPPER.name())); - } - @Override public void categoryGoodsName(String categoryId) { //获取分类下的商品 @@ -699,7 +653,7 @@ public class GoodsServiceImpl extends ServiceImpl implements LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); AuthUser authUser = this.checkStoreAuthority(); if (authUser != null) { - updateWrapper.eq(Goods::getStoreId, authUser.getStoreId()); + updateWrapper.eq(Goods::getStoreId, "-1"); } return updateWrapper; } @@ -713,7 +667,7 @@ public class GoodsServiceImpl extends ServiceImpl implements private AuthUser checkStoreAuthority() { AuthUser currentUser = UserContext.getCurrentUser(); //如果当前会员不为空,且为店铺角色 - if (currentUser != null && (currentUser.getRole().equals(UserEnums.STORE) && currentUser.getStoreId() != null)) { + if (currentUser != null) { return currentUser; } return null; @@ -743,7 +697,7 @@ public class GoodsServiceImpl extends ServiceImpl implements LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); AuthUser authUser = this.checkStoreAuthority(); if (authUser != null) { - queryWrapper.eq(Goods::getStoreId, authUser.getStoreId()); + queryWrapper.eq(Goods::getStoreId, "-1"); } return queryWrapper; } 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 3f8b4dc5c..9e4709da4 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 @@ -241,10 +241,6 @@ public class StoreServiceImpl extends ServiceImpl implements storeLambdaUpdateWrapper.eq(Store::getId, id); storeLambdaUpdateWrapper.set(Store::getStoreDisable, StoreStatusEnum.CLOSED.value()); boolean update = this.update(storeLambdaUpdateWrapper); - //下架所有此店铺商品 - if (update) { - goodsService.underStoreGoods(id); - } //删除店员token clerkService.list(new LambdaQueryWrapper().eq(Clerk::getStoreId, id)).forEach(clerk -> { diff --git a/framework/src/main/java/cn/lili/modules/system/entity/dos/Logistics.java b/framework/src/main/java/cn/lili/modules/system/entity/dos/Logistics.java index 40371ca25..c2459109f 100644 --- a/framework/src/main/java/cn/lili/modules/system/entity/dos/Logistics.java +++ b/framework/src/main/java/cn/lili/modules/system/entity/dos/Logistics.java @@ -63,14 +63,4 @@ public class Logistics extends BaseEntity { @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(); - } } \ No newline at end of file diff --git a/framework/src/main/java/cn/lili/modules/system/entity/dto/ImSetting.java b/framework/src/main/java/cn/lili/modules/system/entity/dto/ImSetting.java index b3c644ae4..c2bcd13eb 100644 --- a/framework/src/main/java/cn/lili/modules/system/entity/dto/ImSetting.java +++ b/framework/src/main/java/cn/lili/modules/system/entity/dto/ImSetting.java @@ -15,8 +15,14 @@ import java.io.Serializable; public class ImSetting implements Serializable { - @ApiModelProperty(value = "平台地址") - private String httpUrl; + @ApiModelProperty(value = "地址") + private String url; + + @ApiModelProperty(value = "企业Id") + private String companyId; + + @ApiModelProperty(value = "二维码") + private String qrCode; } diff --git a/framework/src/main/java/cn/lili/modules/system/entity/dto/LogisticsSearchParams.java b/framework/src/main/java/cn/lili/modules/system/entity/dto/LogisticsSearchParams.java new file mode 100644 index 000000000..f57ebfaf3 --- /dev/null +++ b/framework/src/main/java/cn/lili/modules/system/entity/dto/LogisticsSearchParams.java @@ -0,0 +1,25 @@ +package cn.lili.modules.system.entity.dto; + +import cn.lili.common.vo.PageVO; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author chc + * @since 2022/6/2114:46 + */ +@Data +public class LogisticsSearchParams extends PageVO { + + @ApiModelProperty(value = "支持电子面单") + private Boolean standBy; + + public QueryWrapper queryWrapper() { + QueryWrapper wrapper = new QueryWrapper<>(); + if(standBy != null){ + wrapper.eq("standBy",standBy); + } + return wrapper; + } +} diff --git a/manager-api/src/main/java/cn/lili/controller/goods/DraftGoodsManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/DraftGoodsManagerController.java new file mode 100644 index 000000000..b7af5283b --- /dev/null +++ b/manager-api/src/main/java/cn/lili/controller/goods/DraftGoodsManagerController.java @@ -0,0 +1,65 @@ +package cn.lili.controller.goods; + +import cn.lili.common.enums.ResultCode; +import cn.lili.common.enums.ResultUtil; +import cn.lili.common.exception.ServiceException; +import cn.lili.common.security.OperationalJudgment; +import cn.lili.common.security.context.UserContext; +import cn.lili.common.vo.ResultMessage; +import cn.lili.modules.goods.entity.dos.DraftGoods; +import cn.lili.modules.goods.entity.dto.DraftGoodsDTO; +import cn.lili.modules.goods.entity.dto.DraftGoodsSearchParams; +import cn.lili.modules.goods.entity.vos.DraftGoodsVO; +import cn.lili.modules.goods.service.DraftGoodsService; +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.web.bind.annotation.*; + +import java.util.Objects; + +/** + * 管理端,草稿商品接口 + * + * @author paulG + * @since 2021/2/20 2:26 下午 + */ +@RestController +@Api(tags = "管理端,草稿商品接口") +@RequestMapping("/manager/goods/draftGoods") +public class DraftGoodsManagerController { + @Autowired + private DraftGoodsService draftGoodsService; + + + @ApiOperation(value = "分页获取草稿商品列表") + @GetMapping(value = "/page") + public ResultMessage> getDraftGoodsByPage(DraftGoodsSearchParams searchParams) { + searchParams.setStoreId("-1"); + return ResultUtil.data(draftGoodsService.getDraftGoods(searchParams)); + } + + @ApiOperation(value = "获取草稿商品") + @GetMapping(value = "/{id}") + public ResultMessage getDraftGoods(@PathVariable String id) { + DraftGoodsVO draftGoods = OperationalJudgment.judgment(draftGoodsService.getDraftGoods(id)); + return ResultUtil.data(draftGoods); + } + + @ApiOperation(value = "保存草稿商品") + @PostMapping(value = "/save", consumes = "application/json", produces = "application/json") + public ResultMessage saveDraftGoods(@RequestBody DraftGoodsDTO draftGoodsVO) { + draftGoodsVO.setStoreId("-1"); + draftGoodsService.saveGoodsDraft(draftGoodsVO); + return ResultUtil.success(); + } + + @ApiOperation(value = "删除草稿商品") + @DeleteMapping(value = "/{id}") + public ResultMessage deleteDraftGoods(@PathVariable String id) { + draftGoodsService.deleteGoodsDraft(id); + return ResultUtil.success(); + } + +} diff --git a/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java b/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java index d410b8865..90d5d9187 100644 --- a/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/goods/GoodsManagerController.java @@ -5,16 +5,19 @@ import cn.lili.common.aop.annotation.PreventDuplicateSubmissions; import cn.lili.common.enums.ResultCode; import cn.lili.common.enums.ResultUtil; import cn.lili.common.exception.ServiceException; +import cn.lili.common.security.context.UserContext; 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.dto.GoodsSkuStockDTO; import cn.lili.modules.goods.entity.enums.GoodsAuthEnum; import cn.lili.modules.goods.entity.enums.GoodsStatusEnum; import cn.lili.modules.goods.entity.vos.GoodsVO; import cn.lili.modules.goods.service.GoodsService; import cn.lili.modules.goods.service.GoodsSkuService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -27,6 +30,8 @@ import javax.validation.Valid; import javax.validation.constraints.NotEmpty; import java.util.Arrays; import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; /** * 管理端,商品管理接口 @@ -135,4 +140,38 @@ public class GoodsManagerController { return ResultUtil.success(); } + @ApiOperation(value = "修改商品库存") + @PutMapping(value = "/update/stocks", consumes = "application/json") + public ResultMessage updateStocks(@RequestBody List updateStockList) { + // 获取商品skuId集合 + List goodsSkuIds = updateStockList.stream().map(GoodsSkuStockDTO::getSkuId).collect(Collectors.toList()); + // 根据skuId集合查询商品信息 + List goodsSkuList = goodsSkuService.list(new LambdaQueryWrapper().in(GoodsSku::getId, goodsSkuIds)); + // 过滤不符合当前店铺的商品 + List filterGoodsSkuIds = goodsSkuList.stream().map(GoodsSku::getId).collect(Collectors.toList()); + List collect = updateStockList.stream().filter(i -> filterGoodsSkuIds.contains(i.getSkuId())).collect(Collectors.toList()); + goodsSkuService.updateStocks(collect); + return ResultUtil.success(); + } + + @DemoSite + @ApiOperation(value = "删除商品") + @PutMapping(value = "/delete") + @ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "query", allowMultiple = true) + public ResultMessage deleteGoods(@RequestParam List goodsId) { + goodsService.deleteGoods(goodsId); + return ResultUtil.success(); + } + + @ApiOperation(value = "设置商品运费模板") + @PutMapping(value = "/freight") + @ApiImplicitParams({ + @ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "query", allowMultiple = true), + @ApiImplicitParam(name = "templateId", value = "运费模板ID", required = true, paramType = "query") + }) + public ResultMessage freight(@RequestParam List goodsId, @RequestParam String templateId) { + goodsService.freight(goodsId, templateId); + return ResultUtil.success(); + } + } diff --git a/manager-api/src/main/java/cn/lili/controller/order/AfterSaleManagerController.java b/manager-api/src/main/java/cn/lili/controller/order/AfterSaleManagerController.java index 2764615b5..08a8065f3 100644 --- a/manager-api/src/main/java/cn/lili/controller/order/AfterSaleManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/order/AfterSaleManagerController.java @@ -99,4 +99,19 @@ public class AfterSaleManagerController { public ResultMessage getStoreAfterSaleAddress(@NotNull(message = "售后单号") @PathVariable("sn") String sn) { return ResultUtil.data(afterSaleService.getStoreAfterSaleAddressDTO(sn)); } + + @PreventDuplicateSubmissions + @ApiOperation(value = "卖家确认收货") + @ApiImplicitParams({ + @ApiImplicitParam(name = "afterSaleSn", value = "售后sn", required = true, paramType = "path"), + @ApiImplicitParam(name = "serviceStatus", value = "PASS:审核通过,REFUSE:审核未通过", required = true, paramType = "query"), + @ApiImplicitParam(name = "remark", value = "备注", paramType = "query") + }) + @PutMapping(value = "/confirm/{afterSaleSn}") + public ResultMessage confirm(@NotNull(message = "请选择售后单") @PathVariable String afterSaleSn, + @NotNull(message = "请审核") String serviceStatus, + String remark) { + + return ResultUtil.data(afterSaleService.storeConfirm(afterSaleSn, serviceStatus, remark)); + } } diff --git a/manager-api/src/main/java/cn/lili/controller/other/LogisticsManagerController.java b/manager-api/src/main/java/cn/lili/controller/other/LogisticsManagerController.java index 6ca05e0cb..f2800883f 100644 --- a/manager-api/src/main/java/cn/lili/controller/other/LogisticsManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/other/LogisticsManagerController.java @@ -1,9 +1,9 @@ package cn.lili.controller.other; import cn.lili.common.enums.ResultUtil; -import cn.lili.common.vo.PageVO; import cn.lili.common.vo.ResultMessage; import cn.lili.modules.system.entity.dos.Logistics; +import cn.lili.modules.system.entity.dto.LogisticsSearchParams; import cn.lili.modules.system.service.LogisticsService; import cn.lili.mybatis.util.PageUtil; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -37,8 +37,8 @@ public class LogisticsManagerController { @ApiOperation(value = "分页获取物流公司") @GetMapping(value = "/getByPage") - public ResultMessage> getByPage(PageVO page) { - return ResultUtil.data(logisticsService.page(PageUtil.initPage(page))); + public ResultMessage> getByPage(LogisticsSearchParams page) { + return ResultUtil.data(logisticsService.page(PageUtil.initPage(page),page.queryWrapper())); } @ApiOperation(value = "编辑物流公司") diff --git a/manager-api/src/main/java/cn/lili/controller/promotion/FullDiscountManagerController.java b/manager-api/src/main/java/cn/lili/controller/promotion/FullDiscountManagerController.java index 2d48dee87..137dff36a 100644 --- a/manager-api/src/main/java/cn/lili/controller/promotion/FullDiscountManagerController.java +++ b/manager-api/src/main/java/cn/lili/controller/promotion/FullDiscountManagerController.java @@ -73,6 +73,19 @@ public class FullDiscountManagerController { return ResultUtil.data(fullDiscountVO); } + @ApiOperation(value = "修改满优惠活动") + @PutMapping(consumes = "application/json", produces = "application/json") + public ResultMessage editFullDiscount(@RequestBody FullDiscountVO fullDiscountVO) { + OperationalJudgment.judgment(fullDiscountService.getFullDiscount(fullDiscountVO.getId())); + AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser()); + fullDiscountVO.setStoreId(currentUser.getStoreId()); + fullDiscountVO.setStoreName(currentUser.getStoreName()); + if (!fullDiscountService.updatePromotions(fullDiscountVO)) { + return ResultUtil.error(ResultCode.PINTUAN_EDIT_ERROR); + } + return ResultUtil.success(ResultCode.FULL_DISCOUNT_EDIT_SUCCESS); + } + @ApiOperation(value = "删除满优惠活动") @DeleteMapping("/{id}") public ResultMessage deleteFullDiscount(@PathVariable String id) {