From d10302001c4a6776a190cf97a403dab3816ed4f9 Mon Sep 17 00:00:00 2001 From: jiangqs <jiangqs> Date: 星期二, 04 七月 2023 21:59:30 +0800 Subject: [PATCH] 用户端活动商品 --- ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/AppErrorConstant.java | 6 ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/GoodsMapper.xml | 41 +++ ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/goods/GoodsService.java | 9 ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberCouponServiceImpl.java | 1 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/task/MemberTaskService.java | 5 ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/management/MgtMemberController.java | 10 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/order/OrderService.java | 4 ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/member/MemberArchiveFieldsService.java | 10 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/business/MerTaskController.java | 2 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppHomeController.java | 22 + ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/AppSimpleGoodsVo.java | 3 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/AppHomeActivityVo.java | 28 ++ ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowPhoneDto.java | 26 ++ ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskServiceImpl.java | 4 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowMemberTaskDto.java | 10 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowAgencyTaskDto.java | 8 ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberArchiveFieldsServiceImpl.java | 15 + ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java | 49 +++ ruoyi-modules/ruoyi-goods/src/main/resources/mapper/activity/ActivityMapper.xml | 15 + ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java | 2 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/goods/GoodsMapper.java | 9 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/activity/ActivityServiceImpl.java | 24 ++ ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java | 26 ++ ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/activity/ActivityService.java | 18 + ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/AppSimpleActivityGoodsVo.java | 5 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/MemberTaskServiceImpl.java | 141 ++++++++---- ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/AppSearchGoodsPageDto.java | 5 ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/business/MerOrderController.java | 4 ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/activity/ActivityMapper.java | 18 + ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/AgencyTaskServiceImpl.java | 117 ++++++---- 30 files changed, 495 insertions(+), 142 deletions(-) diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/AppErrorConstant.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/AppErrorConstant.java index b6e478d..e11de46 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/AppErrorConstant.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/constant/AppErrorConstant.java @@ -60,7 +60,7 @@ String COUPON_EXPIRED = "优惠券已过期"; - String COUPON_USED = "优惠券已被核销"; + String COUPON_USED = "该核销码已核销,请更换"; String COUPON_TYPE_ERROR = "只能核销商品优惠券"; @@ -70,4 +70,8 @@ String COUPON_AUDIT_EDIT = "只能编辑审核拒绝的优惠券"; + String VERIFY_USED = "该核销码已核销,请更换"; + + String VERIFY_SHOP_ERROR = "该核销码不适用于本店铺"; + } diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppHomeController.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppHomeController.java index 0dbf3bf..c14d4d9 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppHomeController.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/controller/miniapp/AppHomeController.java @@ -8,6 +8,7 @@ import com.ruoyi.goods.domain.dto.AppRecommendGoodsPageDto; import com.ruoyi.goods.domain.dto.AppSearchGoodsPageDto; import com.ruoyi.goods.domain.dto.AppShopGoodsPageDto; +import com.ruoyi.goods.domain.vo.AppHomeActivityVo; import com.ruoyi.goods.domain.vo.AppSimpleActivityGoodsVo; import com.ruoyi.goods.domain.vo.AppSimpleGoodsVo; import com.ruoyi.goods.service.goods.GoodsService; @@ -44,9 +45,28 @@ private GoodsService goodsService; + @RequestMapping(value = "/pageActivityGoods", method = RequestMethod.POST) + @ApiOperation(value = "热门活动") + public R<AppHomeActivityVo> pageActivityGoods(@RequestBody AppRecommendGoodsPageDto appRecommendGoodsPageDto) { + Long userId = SecurityUtils.getUserId(); + Long shopId = null; + if(userId!=null){ + Member member = memberService.getMember(userId).getData(); + if(member!=null&&member.getRelationShopId()!=null){ + shopId = member.getRelationShopId(); + } + }else{ + shopId = appRecommendGoodsPageDto.getPositionShopId(); + } + if(shopId==null){ + throw new ServiceException(AppErrorConstant.NO_POSITION); + } + AppHomeActivityVo homeActivityVo = goodsService.pageActivityGoods(shopId); + return R.ok(homeActivityVo); + } @RequestMapping(value = "/pageRecommendGoods", method = RequestMethod.POST) - @ApiOperation(value = "推荐商品") + @ApiOperation(value = "商城精选") public R<Page<AppSimpleGoodsVo>> pageRecommendGoods(@RequestBody AppRecommendGoodsPageDto appRecommendGoodsPageDto) { Long userId = SecurityUtils.getUserId(); Long shopId = null; diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/AppSearchGoodsPageDto.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/AppSearchGoodsPageDto.java index 0041f42..099ff79 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/AppSearchGoodsPageDto.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/dto/AppSearchGoodsPageDto.java @@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; +import java.util.List; + /** * @author jqs34 * @ClassName AppShopGoodsPageDto @@ -22,4 +24,7 @@ @ApiModelProperty(value = "定位获取商户id") private Long positionShopId; + + @ApiModelProperty(value = "定位获取商户id",hidden = true) + private List<String> activityIdList; } diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/AppHomeActivityVo.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/AppHomeActivityVo.java new file mode 100644 index 0000000..c4ec6de --- /dev/null +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/AppHomeActivityVo.java @@ -0,0 +1,28 @@ +package com.ruoyi.goods.domain.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; +import java.util.List; + +/** + * @ClassName AppHomeActivityVo + * @Description TODO + * @Author jqs + * @Date 2023/7/4 18:43 + * @Version 1.0 + */ +@Data +public class AppHomeActivityVo { + + @ApiModelProperty(value = "结束时间戳") + private long timestamp; + + @ApiModelProperty(value = "结束时间") + private Date endTime; + + @ApiModelProperty(value = "活动商品列表") + private List<AppSimpleGoodsVo> goodsVoList; + +} diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/AppSimpleActivityGoodsVo.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/AppSimpleActivityGoodsVo.java index 60a8589..877fa7e 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/AppSimpleActivityGoodsVo.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/AppSimpleActivityGoodsVo.java @@ -4,6 +4,7 @@ import lombok.Data; import java.math.BigDecimal; +import java.util.Date; /** * @author jqs34 @@ -51,5 +52,9 @@ @ApiModelProperty(value = "已售比例") private BigDecimal salesPercent; + @ApiModelProperty(value = "结束时间戳") + private long timestamp; + @ApiModelProperty(value = "结束时间") + private Date endTime; } diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/AppSimpleGoodsVo.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/AppSimpleGoodsVo.java index 6cd8c6a..ef9d76a 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/AppSimpleGoodsVo.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/domain/vo/AppSimpleGoodsVo.java @@ -39,5 +39,6 @@ @ApiModelProperty(value = "商品售价") private BigDecimal salesPrice; - + @ApiModelProperty(value = "活动售价") + private BigDecimal activityPrice; } diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/activity/ActivityMapper.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/activity/ActivityMapper.java index fe7a0ee..2c7f7f3 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/activity/ActivityMapper.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/activity/ActivityMapper.java @@ -61,4 +61,22 @@ * @return List<MgtActivityListVo> */ List<MgtActivityListVo> listMgtActivity(); + + /** + * @description 获取商户推荐活动 + * @author jqs + * @date 2023/7/4 18:14 + * @param shopId + * @return Activity + */ + Activity getRecommendActivity(@Param("shopId")Long shopId); + + /** + * @description 获取商户参与活动id + * @author jqs + * @date 2023/7/4 19:55 + * @param shopId + * @return List<Long> + */ + List<String> listActivityIdByShopId(@Param("shopId")Long shopId); } diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/goods/GoodsMapper.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/goods/GoodsMapper.java index 68196ca..01dd35f 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/goods/GoodsMapper.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/mapper/goods/GoodsMapper.java @@ -28,6 +28,15 @@ List<AppSimpleGoodsVo> pageRecommendGoods(Page page, @Param("shopId")Long shopId); /** + * @description 获取活动精选 + * @author jqs + * @date 2023/7/4 18:06 + * @param activityId + * @return List<AppSimpleGoodsVo> + */ + List<AppSimpleGoodsVo> pageActivityGoods(@Param("activityId")String activityId, @Param("shopId")Long shopId); + + /** * 获取商城商品列表 * @param page * @param appShopGoodsPageDto diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/activity/ActivityService.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/activity/ActivityService.java index 4906958..29db214 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/activity/ActivityService.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/activity/ActivityService.java @@ -84,4 +84,22 @@ * @return List<MgtActivityListVo> */ List<MgtActivityListVo> listMgtActivity(); + + /** + * @description 获取商户推荐活动 + * @author jqs + * @date 2023/7/4 18:14 + * @param shopId + * @return Activity + */ + Activity getRecommendActivity(Long shopId); + + /** + * @description 获取商户参与活动id + * @author jqs + * @date 2023/7/4 19:55 + * @param shopId + * @return List<String> + */ + List<String> listActivityIdByShopId(Long shopId); } diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/goods/GoodsService.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/goods/GoodsService.java index f724161..6141796 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/goods/GoodsService.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/goods/GoodsService.java @@ -27,6 +27,15 @@ List<AppSimpleGoodsVo> pageRecommendGoods(Page page, Long shopId); /** + * @description 获取活动精选 + * @author jqs + * @date 2023/7/4 18:06 + * @param shopId + * @return List<AppSimpleGoodsVo> + */ + AppHomeActivityVo pageActivityGoods(Long shopId); + + /** * 获取商城商品列表 * @param page * @param appShopGoodsPageDto diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/activity/ActivityServiceImpl.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/activity/ActivityServiceImpl.java index 813eec9..93faaeb 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/activity/ActivityServiceImpl.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/activity/ActivityServiceImpl.java @@ -278,4 +278,28 @@ public List<MgtActivityListVo> listMgtActivity(){ return activityMapper.listMgtActivity(); } + + /** + * @description 获取商户推荐活动 + * @author jqs + * @date 2023/7/4 18:14 + * @param shopId + * @return Activity + */ + @Override + public Activity getRecommendActivity(Long shopId){ + return activityMapper.getRecommendActivity(shopId); + } + + /** + * @description 获取商户参与活动id + * @author jqs + * @date 2023/7/4 19:55 + * @param shopId + * @return List<Long> + */ + @Override + public List<String> listActivityIdByShopId(Long shopId){ + return activityMapper.listActivityIdByShopId(shopId); + } } diff --git a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java index 460292a..d00f006 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java +++ b/ruoyi-modules/ruoyi-goods/src/main/java/com/ruoyi/goods/service/impl/goods/GoodsServiceImpl.java @@ -9,10 +9,12 @@ import com.ruoyi.common.core.utils.uuid.IdUtils; import com.ruoyi.common.security.utils.CodeFactoryUtil; import com.ruoyi.goods.domain.dto.*; +import com.ruoyi.goods.domain.pojo.activity.Activity; import com.ruoyi.goods.domain.pojo.goods.GoodsTotal; import com.ruoyi.goods.domain.vo.*; import com.ruoyi.goods.mapper.goods.GoodsMapper; import com.ruoyi.goods.service.activity.ActivityGoodsService; +import com.ruoyi.goods.service.activity.ActivityService; import com.ruoyi.goods.service.goods.GoodsFileService; import com.ruoyi.goods.service.goods.GoodsService; import com.ruoyi.goods.service.goods.GoodsTotalService; @@ -62,7 +64,8 @@ @Resource private GoodsTotalService goodsTotalService; - + @Resource + private ActivityService activityService; /** * @description 获取推荐商品列表 @@ -75,6 +78,27 @@ public List<AppSimpleGoodsVo> pageRecommendGoods(Page page, Long shopId){ List<AppSimpleGoodsVo> appSimpleGoodsVoList = goodsMapper.pageRecommendGoods(page,shopId); return appSimpleGoodsVoList; + } + + /** + * @description 获取活动精选 + * @author jqs + * @date 2023/7/4 18:06 + * @param shopId + * @return List<AppSimpleGoodsVo> + */ + @Override + public AppHomeActivityVo pageActivityGoods(Long shopId){ + AppHomeActivityVo appHomeActivityVo = new AppHomeActivityVo(); + Activity activity = activityService.getRecommendActivity(shopId); + List<AppSimpleGoodsVo> simpleGoodsVoList = new ArrayList<>(); + if(activity!=null){ + appHomeActivityVo.setEndTime(activity.getActivityEndTime()); + appHomeActivityVo.setTimestamp(activity.getActivityEndTime().getTime()); + simpleGoodsVoList = goodsMapper.pageActivityGoods(activity.getActivityId(),shopId); + appHomeActivityVo.setGoodsVoList(simpleGoodsVoList); + } + return appHomeActivityVo; } /** @@ -109,19 +133,24 @@ */ @Override public List<AppSimpleActivityGoodsVo> pageSearchActivityGoods(Page page, AppSearchGoodsPageDto appSearchGoodsPageDto){ - List<AppSimpleActivityGoodsVo> appSimpleGoodsVoList = goodsMapper.pageSearchActivityGoods(page,appSearchGoodsPageDto); - int activityNumber; - int salesNumber; - BigDecimal salesPercent; - for(AppSimpleActivityGoodsVo appSimpleActivityGoodsVo : appSimpleGoodsVoList){ - activityNumber = appSimpleActivityGoodsVo.getActivityNumber(); - salesNumber = appSimpleActivityGoodsVo.getSalesNumber(); - salesPercent = BigDecimal.ZERO; - if(activityNumber != 0){ + List<String> activityIdList = activityService.listActivityIdByShopId(appSearchGoodsPageDto.getShopId()); + appSearchGoodsPageDto.setActivityIdList(activityIdList); + // 获取搜索结果的商品列表 + List<AppSimpleActivityGoodsVo> appSimpleGoodsVoList = goodsMapper.pageSearchActivityGoods(page, appSearchGoodsPageDto); + // 计算销售百分比和设置时间戳 + for (AppSimpleActivityGoodsVo appSimpleActivityGoodsVo : appSimpleGoodsVoList) { + int activityNumber = appSimpleActivityGoodsVo.getActivityNumber(); + int salesNumber = appSimpleActivityGoodsVo.getSalesNumber(); + BigDecimal salesPercent = BigDecimal.ZERO; + // 计算销售百分比 + if (activityNumber != 0) { salesPercent = BigDecimal.valueOf(salesNumber).multiply(BigDecimal.valueOf(100)).divide(BigDecimal.valueOf(activityNumber), 2, BigDecimal.ROUND_HALF_UP); } + // 设置销售百分比和时间戳 appSimpleActivityGoodsVo.setSalesPercent(salesPercent); + appSimpleActivityGoodsVo.setTimestamp(appSimpleActivityGoodsVo.getEndTime().getTime()); } + // 返回结果 return appSimpleGoodsVoList; } diff --git a/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/activity/ActivityMapper.xml b/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/activity/ActivityMapper.xml index e284d9d..fa7c846 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/activity/ActivityMapper.xml +++ b/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/activity/ActivityMapper.xml @@ -102,4 +102,19 @@ WHERE ta.del_flag = 0 ORDER BY ta.create_time DESC </select> + + <select id="getRecommendActivity" resultType="com.ruoyi.goods.domain.pojo.activity.Activity"> + SELECT * FROM t_activity + WHERE del_flag = 0 AND recommend_flag = 1 AND NOW() BETWEEN activity_start_time AND activity_end_time + AND activity_status = 1 AND shop_flag = 1 OR (shop_flag = 2 AND FIND_IN_SET(#{shopId}, ta.applicable_shop) > 0) + ORDER BY activity_end_time - NOW() + LIMIT 1; + </select> + + + <select id="listActivityIdByShopId" resultType="java.lang.String"> + SELECT activity_id FROM t_activity + WHERE del_flag = 0 AND activity_status = 1 AND NOW() BETWEEN activity_start_time AND activity_end_time + AND shop_flag = 1 OR (shop_flag = 2 AND FIND_IN_SET(#{shopId}, ta.applicable_shop) > 0) + </select> </mapper> diff --git a/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/GoodsMapper.xml b/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/GoodsMapper.xml index 49d498f..b29f661 100644 --- a/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/GoodsMapper.xml +++ b/ruoyi-modules/ruoyi-goods/src/main/resources/mapper/goods/GoodsMapper.xml @@ -169,6 +169,30 @@ ORDER BY tg.create_time DESC </select> + <select id="pageActivityGoods" resultType="com.ruoyi.goods.domain.vo.AppSimpleGoodsVo"> + SELECT + tg.goods_id goodsId, + tg.goods_name goodsName, + tg.goods_introduction goodsIntroduction, + tg.goods_type goodsType, + CASE tg.goods_type + WHEN 1 THEN "周期" + WHEN 2 THEN "服务" + WHEN 3 THEN "体验" + WHEN 4 THEN "单品" + END goodsTag, + IFNULL(tsg.sales_price,tg.sales_price) salesPrice, + tgf.file_url goodsPicture, + tg.goods_nurses goodsNurses, + tag.activity_price activityPrice + FROM t_activity_goods tag + INNER JOIN t_goods tg ON tag.goods_id = tg.goods_id + LEFT JOIN t_goods_file tgf ON tg.goods_id = tgf.goods_id AND tgf.del_flag = 0 AND tgf.file_type = 1 + LEFT JOIN t_shop_goods tsg ON tg.goods_id = tsg.goods_id AND tsg.shop_id = #{shopId} + WHERE tag.activity_id = #{activityId} AND tg.del_flag = 0 AND tg.goods_status = 1 + ORDER BY tag.sales_number DESC, tg.create_time DESC LIMIT 6 + </select> + <!--分页获取商城商品列表--> <select id="pageShopGoods" resultType="com.ruoyi.goods.domain.vo.AppSimpleGoodsVo"> SELECT @@ -268,12 +292,19 @@ tgf.file_url goodsPicture, tg.goods_tags goodsNurses, tag.activity_number activityNumber, - tag.sales_number salesNumber - FROM t_goods tg - INNER JOIN t_activity_goods tag ON tg.goods_id = tag.goods_id - INNER JOIN t_goods_file tgf ON tg.goods_id = tgf.goods_id AND tgf.del_flag = 0 AND tgf.file_type = 1 + tag.sales_number salesNumber, + tag.activity_deadline endTime + FROM t_activity_goods tag + INNER JOIN t_goods tg ON tg.goods_id = tag.goods_id + LEFT JOIN t_goods_file tgf ON tg.goods_id = tgf.goods_id AND tgf.del_flag = 0 AND tgf.file_type = 1 LEFT JOIN t_shop_goods tsg ON tg.goods_id = tsg.goods_id AND tsg.shop_id = #{param.shopId} WHERE tg.del_flag = 0 AND tg.goods_status = 1 + <if test="param.activityIdList != null and param.activityIdList.size() > 0"> + AND tag.activity_id IN + <foreach collection="param.activityIdList" item="item" open="(" separator="," close=")"> + #{item} + </foreach> + </if> <if test="param.keyword!=null and param.keyword != ''"> AND tg.goods_name LIKE CONCAT('%',#{param.keyword},'%') </if> @@ -300,7 +331,7 @@ tg.service_num defaultServiceNum, IFNULL(tsg.service_num,tg.service_num) serviceNum FROM t_goods tg - INNER JOIN t_goods_file tgf ON tg.goods_id = tgf.goods_id AND tgf.del_flag = 0 AND tgf.file_type = 1 + LEFT JOIN t_goods_file tgf ON tg.goods_id = tgf.goods_id AND tgf.del_flag = 0 AND tgf.file_type = 1 LEFT JOIN t_shop_goods tsg ON tg.goods_id = tsg.goods_id AND tsg.shop_id = #{param.shopId} AND tsg.del_flag = 0 WHERE tg.del_flag = 0 AND tg.goods_status = 1 <if test="param.goodsType != null and param.goodsType != ''"> diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/management/MgtMemberController.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/management/MgtMemberController.java index 1e222f7..3856b82 100644 --- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/management/MgtMemberController.java +++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/controller/management/MgtMemberController.java @@ -177,6 +177,16 @@ return R.ok(); } + @RequestMapping(value = "/deleteMemberArchiveFields", method = RequestMethod.POST) + @Log(title = "会员管理", businessType = BusinessType.UPDATE,operContent = "删除会员档案") + @ApiOperation(value = "删除会员档案") + public R deleteMemberArchiveFields(@RequestBody MgtBaseGetDto mgtBaseGetDto) { + Long userId = SecurityUtils.getUserId(); + mgtBaseGetDto.setUserId(userId); + memberArchiveFieldsService.deleteMemberArchiveFields(mgtBaseGetDto); + return R.ok(); + } + @RequestMapping(value = "/pageMgtMemberSuggest", method = RequestMethod.POST) @ApiOperation(value = "平台获取用户建议列表") diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java index d11c200..8ddaac8 100644 --- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java +++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/coupon/CouponServiceImpl.java @@ -355,7 +355,7 @@ userIdList = relUserIdList; } } - if(!relUserIdList.isEmpty()){ + if(relUserIdList!=null&&!relUserIdList.isEmpty()){ List<MemberCoupon> memberCouponList = new ArrayList<>(); MemberCoupon memberCoupon; Integer sendTotal = 0; diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberArchiveFieldsServiceImpl.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberArchiveFieldsServiceImpl.java index ad60289..05b8323 100644 --- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberArchiveFieldsServiceImpl.java +++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberArchiveFieldsServiceImpl.java @@ -6,6 +6,7 @@ import com.ruoyi.member.mapper.member.MemberArchiveFieldsMapper; import com.ruoyi.member.service.member.MemberArchiveFieldsService; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.system.api.domain.dto.MgtBaseGetDto; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -66,4 +67,18 @@ public List<MgtArchiveFieldsListVo> listMgtArchiveFields(){ return memberArchiveFieldsMapper.listMgtArchiveFields(); } + + /** + * @description 删除会员档案 + * @author jqs + * @date 2023/7/4 19:26 + * @param mgtBaseGetDto + * @return void + */ + @Override + public void deleteMemberArchiveFields(MgtBaseGetDto mgtBaseGetDto){ + MemberArchiveFields memberArchiveFields = this.getById(mgtBaseGetDto.getId()); + memberArchiveFields.setDelFlag(1); + this.saveOrUpdate(memberArchiveFields); + } } diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberCouponServiceImpl.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberCouponServiceImpl.java index df39976..16c5936 100644 --- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberCouponServiceImpl.java +++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/impl/member/MemberCouponServiceImpl.java @@ -88,6 +88,7 @@ } else { merVerifyCouponGetVo.setCouponFrom("平台"); } + merVerifyCouponGetVo.setMemberCoupon(memberCoupon); return merVerifyCouponGetVo; } diff --git a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/member/MemberArchiveFieldsService.java b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/member/MemberArchiveFieldsService.java index e2ad335..7131fb9 100644 --- a/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/member/MemberArchiveFieldsService.java +++ b/ruoyi-modules/ruoyi-member/src/main/java/com/ruoyi/member/service/member/MemberArchiveFieldsService.java @@ -4,6 +4,7 @@ import com.ruoyi.member.domain.pojo.member.MemberArchiveFields; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.member.domain.vo.MgtArchiveFieldsListVo; +import com.ruoyi.system.api.domain.dto.MgtBaseGetDto; import java.util.List; @@ -37,4 +38,13 @@ * @return List<MgtArchiveFieldsListVo> */ List<MgtArchiveFieldsListVo> listMgtArchiveFields(); + + /** + * @description 删除会员档案 + * @author jqs + * @date 2023/7/4 19:26 + * @param mgtBaseGetDto + * @return void + */ + void deleteMemberArchiveFields(MgtBaseGetDto mgtBaseGetDto); } diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/business/MerOrderController.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/business/MerOrderController.java index 16f5118..c6c5202 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/business/MerOrderController.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/controller/business/MerOrderController.java @@ -50,11 +50,11 @@ merVerifyCodeVo.setVerifyType(type); switch(type){ case 1: - MerVerifyOrderVo merVerifyOrderVo = orderService.verifyOrder(verifyCode); + MerVerifyOrderVo merVerifyOrderVo = orderService.verifyOrder(verifyCode,merVerifyCodeDto.getShopId()); merVerifyCodeVo.setMerVerifyOrderVo(merVerifyOrderVo); break; case 2: - MerVerifyCouponVo merVerifyCouponVo = orderService.verifyCoupon(verifyCode); + MerVerifyCouponVo merVerifyCouponVo = orderService.verifyCoupon(verifyCode,merVerifyCodeDto.getShopId()); merVerifyCodeVo.setMerVerifyCouponVo(merVerifyCouponVo); break; case 3: diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java index 9c6b785..db689f6 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java @@ -529,11 +529,17 @@ * @return */ @Override - public MerVerifyOrderVo verifyOrder(String orderId) { + public MerVerifyOrderVo verifyOrder(String orderId,Long shopId) { // 创建返回对象 MerVerifyOrderVo merVerifyOrderVo = new MerVerifyOrderVo(); // 根据订单ID获取订单信息 Order order = this.getById(orderId); + if(order.getOrderStatus()!=2){ + throw new ServiceException(AppErrorConstant.VERIFY_USED); + } + if(!order.getShopId().equals(shopId)){ + throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR); + } // 根据订单ID获取订单商品列表 List<AppUserOrderGoodsPageVo> appUserOrderGoodsPageVoList = orderGoodsService.listAppVoByOrderId(orderId); // 设置返回对象的属性值 @@ -574,6 +580,9 @@ Date nowTime = new Date(); //更新订单信息 Order order = this.getById(orderId); + if(order.getOrderStatus()!=2){ + throw new ServiceException(AppErrorConstant.VERIFY_USED); + } order.setOrderStatus(3); order.setUseTime(nowTime); order.setUseUserId(merVerifyOrderDto.getUserId()); @@ -2000,11 +2009,24 @@ * @date 2023/6/27 11:10 */ @Override - public MerVerifyCouponVo verifyCoupon(String verifyCode) { + public MerVerifyCouponVo verifyCoupon(String verifyCode,Long shopId) { // 创建MerVerifyCouponVo对象 MerVerifyCouponVo merVerifyCouponVo = new MerVerifyCouponVo(); // 调用remoteCouponService的getVerifyCoupon方法获取MerVerifyCouponGetVo对象 MerVerifyCouponGetVo verifyCouponGetVo = remoteCouponService.getVerifyCoupon(verifyCode).getData(); + MemberCoupon memberCoupon = verifyCouponGetVo.getMemberCoupon(); + // 检查优惠券状态 + int couponStatus = memberCoupon.getCouponStatus(); + if (couponStatus == 0) { + throw new ServiceException(AppErrorConstant.COUPON_EXPIRED); + } else if (couponStatus == 2) { + throw new ServiceException(AppErrorConstant.COUPON_USED); + } else if (couponStatus != 0) { + throw new ServiceException(AppErrorConstant.COUPON_NO_FIND); + } + if(!memberCoupon.getShopId().equals(shopId)){ + throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR); + } List<Goods> goodsList = verifyCouponGetVo.getGoodsList(); Long userId = verifyCouponGetVo.getUserId(); // 调用remoteMemberService的getMember方法获取Member对象 diff --git a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/order/OrderService.java b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/order/OrderService.java index 978f2b2..bc8be49 100644 --- a/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/order/OrderService.java +++ b/ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/order/OrderService.java @@ -80,7 +80,7 @@ * @param orderId * @return */ - MerVerifyOrderVo verifyOrder(String orderId); + MerVerifyOrderVo verifyOrder(String orderId,Long shopId); /** * 确认核销订单 @@ -286,7 +286,7 @@ * @param verifyCode * @return MerVerifyCouponVo */ - MerVerifyCouponVo verifyCoupon(String verifyCode); + MerVerifyCouponVo verifyCoupon(String verifyCode,Long shopId); /** * @description 获取用户未支付金额 diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/business/MerTaskController.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/business/MerTaskController.java index f12102d..972a364 100644 --- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/business/MerTaskController.java +++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/business/MerTaskController.java @@ -124,7 +124,7 @@ } @RequestMapping(value = "/followAgencyTask", method = RequestMethod.POST) - @ApiOperation(value = "会员代理商跟进") + @ApiOperation(value = "代理商跟进") public R followAgencyTask(@RequestBody MerFollowAgencyTaskDto merFollowAgencyTaskDto) { Long userId = SecurityUtils.getUserId(); merFollowAgencyTaskDto.setUserId(userId); diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowAgencyTaskDto.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowAgencyTaskDto.java index a9c89c9..faa84ef 100644 --- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowAgencyTaskDto.java +++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowAgencyTaskDto.java @@ -1,11 +1,10 @@ package com.ruoyi.shop.domain.dto; -import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.system.api.domain.dto.MerBaseDto; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; +import java.util.List; /** * @author jqs34 @@ -26,9 +25,8 @@ @ApiModelProperty("拨打电话") private String callPhone; - @ApiModelProperty("电话时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00") - private Date callTime; + @ApiModelProperty("电话跟踪内容") + private List<MerFollowPhoneDto> followPhone; @ApiModelProperty("跟踪内容") private String followContent; diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowMemberTaskDto.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowMemberTaskDto.java index d76ca8c..c8f2cb8 100644 --- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowMemberTaskDto.java +++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowMemberTaskDto.java @@ -1,11 +1,10 @@ package com.ruoyi.shop.domain.dto; -import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.system.api.domain.dto.MerBaseDto; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -import java.util.Date; +import java.util.List; /** * @author jqs34 @@ -26,11 +25,10 @@ @ApiModelProperty("拨打电话") private String callPhone; - @ApiModelProperty("电话时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00") - private Date callTime; + @ApiModelProperty("电话跟踪内容") + private List<MerFollowPhoneDto> followPhone; - @ApiModelProperty("跟踪内容") + @ApiModelProperty("手动跟踪内容") private String followContent; @ApiModelProperty("跟进图片地址 多个,号隔开") diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowPhoneDto.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowPhoneDto.java new file mode 100644 index 0000000..7c5ebcf --- /dev/null +++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/domain/dto/MerFollowPhoneDto.java @@ -0,0 +1,26 @@ +package com.ruoyi.shop.domain.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * @ClassName MerFollowPhoneDto + * @Description TODO + * @Author jqs + * @Date 2023/7/4 17:01 + * @Version 1.0 + */ +@Data +public class MerFollowPhoneDto { + + @ApiModelProperty("电话时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00") + private Date callTime; + + @ApiModelProperty("跟踪内容") + private String followContent; + +} diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/AgencyTaskServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/AgencyTaskServiceImpl.java index fe6a4b8..445e4a5 100644 --- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/AgencyTaskServiceImpl.java +++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/AgencyTaskServiceImpl.java @@ -8,6 +8,7 @@ import com.ruoyi.shop.domain.dto.MerAgencyTaskPageDto; import com.ruoyi.shop.domain.dto.MerCreateAgencyTaskDto; import com.ruoyi.shop.domain.dto.MerFollowAgencyTaskDto; +import com.ruoyi.shop.domain.dto.MerFollowPhoneDto; import com.ruoyi.shop.domain.pojo.task.*; import com.ruoyi.shop.domain.vo.MerAgencyTaskPageVo; import com.ruoyi.shop.mapper.task.AgencyTaskMapper; @@ -79,59 +80,75 @@ */ @Override public void followAgencyTask(MerFollowAgencyTaskDto merFollowAgencyTaskDto){ - AgencyTaskRecord agencyTaskRecord = new AgencyTaskRecord(); + AgencyTaskRecord agencyTaskRecord; AgencyTask oldAgencyTask = this.getById(merFollowAgencyTaskDto.getTaskId()); - //更新任务 - agencyTaskRecord.setTaskId(merFollowAgencyTaskDto.getTaskId()); - agencyTaskRecord.setDelFlag(0); - agencyTaskRecord.setUserId(merFollowAgencyTaskDto.getUserId()); - agencyTaskRecord.setFollowType(merFollowAgencyTaskDto.getFollowType()); - agencyTaskRecord.setCallPhone(merFollowAgencyTaskDto.getCallPhone()); - agencyTaskRecord.setCallTime(merFollowAgencyTaskDto.getCallTime()); - agencyTaskRecord.setFollowContent(merFollowAgencyTaskDto.getFollowContent()); - agencyTaskRecord.setCreateTime(new Date()); - agencyTaskRecordService.saveOrUpdate(agencyTaskRecord); - //创建任务详情文件 - String picture = merFollowAgencyTaskDto.getPicture(); - String video = merFollowAgencyTaskDto.getVideo(); - String audio = merFollowAgencyTaskDto.getAudio(); - String[] strArr; - TaskFile taskFile; - if(StringUtils.isNotBlank(picture)){ - strArr = picture.split(","); - for(String str : strArr){ - taskFile = new TaskFile(); - taskFile.setDelFlag(0); - taskFile.setFollowId(agencyTaskRecord.getId()); - taskFile.setFollowFrom(2); - taskFile.setFileUrl(str); - taskFile.setFileType(1); - taskFileService.saveOrUpdate(taskFile); + oldAgencyTask.setTaskStatus(2); + this.saveOrUpdate(oldAgencyTask); + if(merFollowAgencyTaskDto.getFollowType()==1){ + // 获取跟进电话列表 + List<MerFollowPhoneDto> followPhone = merFollowAgencyTaskDto.getFollowPhone(); + // 判断跟进电话列表是否为空 + if (followPhone != null && !followPhone.isEmpty()) { + // 遍历跟进电话列表 + for (MerFollowPhoneDto followPhoneDto : followPhone) { + // 创建新的会员任务记录 + agencyTaskRecord = new AgencyTaskRecord(); + //更新任务 + agencyTaskRecord.setTaskId(merFollowAgencyTaskDto.getTaskId()); + agencyTaskRecord.setDelFlag(0); + agencyTaskRecord.setUserId(merFollowAgencyTaskDto.getUserId()); + agencyTaskRecord.setFollowType(merFollowAgencyTaskDto.getFollowType()); + agencyTaskRecord.setCallPhone(merFollowAgencyTaskDto.getCallPhone()); + agencyTaskRecord.setCallTime(followPhoneDto.getCallTime()); + agencyTaskRecord.setFollowContent(followPhoneDto.getFollowContent()); + agencyTaskRecord.setCreateTime(new Date()); + agencyTaskRecordService.saveOrUpdate(agencyTaskRecord); + } } - } - if(StringUtils.isNotBlank(video)){ - strArr = picture.split(","); - for(String str : strArr){ - taskFile = new TaskFile(); - taskFile.setDelFlag(0); - taskFile.setFollowId(agencyTaskRecord.getId()); - taskFile.setFollowFrom(2); - taskFile.setFileUrl(str); - taskFile.setFileType(2); - taskFileService.saveOrUpdate(taskFile); + }else{ + agencyTaskRecord = new AgencyTaskRecord(); + //创建任务详情文件 + String picture = merFollowAgencyTaskDto.getPicture(); + String video = merFollowAgencyTaskDto.getVideo(); + String audio = merFollowAgencyTaskDto.getAudio(); + String[] strArr; + TaskFile taskFile; + if(StringUtils.isNotBlank(picture)){ + strArr = picture.split(","); + for(String str : strArr){ + taskFile = new TaskFile(); + taskFile.setDelFlag(0); + taskFile.setFollowId(agencyTaskRecord.getId()); + taskFile.setFollowFrom(2); + taskFile.setFileUrl(str); + taskFile.setFileType(1); + taskFileService.saveOrUpdate(taskFile); + } + } + if(StringUtils.isNotBlank(video)){ + strArr = picture.split(","); + for(String str : strArr){ + taskFile = new TaskFile(); + taskFile.setDelFlag(0); + taskFile.setFollowId(agencyTaskRecord.getId()); + taskFile.setFollowFrom(2); + taskFile.setFileUrl(str); + taskFile.setFileType(2); + taskFileService.saveOrUpdate(taskFile); + } } - } - if(StringUtils.isNotBlank(audio)){ - strArr = picture.split(","); - for(String str : strArr){ - taskFile = new TaskFile(); - taskFile.setDelFlag(0); - taskFile.setFollowId(agencyTaskRecord.getId()); - taskFile.setFollowFrom(2); - taskFile.setFileUrl(str); - taskFile.setFileType(3); - taskFileService.saveOrUpdate(taskFile); + if(StringUtils.isNotBlank(audio)){ + strArr = picture.split(","); + for(String str : strArr){ + taskFile = new TaskFile(); + taskFile.setDelFlag(0); + taskFile.setFollowId(agencyTaskRecord.getId()); + taskFile.setFollowFrom(2); + taskFile.setFileUrl(str); + taskFile.setFileType(3); + taskFileService.saveOrUpdate(taskFile); + } } } //创建新任务 @@ -148,7 +165,5 @@ agencyTask.setCreateTime(new Date()); this.saveOrUpdate(agencyTask); } - - } } diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/MemberTaskServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/MemberTaskServiceImpl.java index 9b0874d..f5acba0 100644 --- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/MemberTaskServiceImpl.java +++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/MemberTaskServiceImpl.java @@ -6,6 +6,7 @@ import com.ruoyi.common.core.utils.uuid.IdUtils; import com.ruoyi.shop.domain.dto.MerCreateMemberTaskDto; import com.ruoyi.shop.domain.dto.MerFollowMemberTaskDto; +import com.ruoyi.shop.domain.dto.MerFollowPhoneDto; import com.ruoyi.shop.domain.dto.MerMemberTaskPageDto; import com.ruoyi.shop.domain.pojo.task.MemberTask; import com.ruoyi.shop.domain.pojo.task.MemberTaskRecord; @@ -92,64 +93,100 @@ } /** - * + * @description 会员任务跟进 + * @author jqs + * @date 2023/7/4 17:16 * @param merFollowMemberTaskDto + * @return void */ @Override - public void followMemberTask(MerFollowMemberTaskDto merFollowMemberTaskDto){ - MemberTaskRecord memberTaskRecord = new MemberTaskRecord(); + public void followMemberTask(MerFollowMemberTaskDto merFollowMemberTaskDto) { + // 创建会员任务记录对象 + MemberTaskRecord memberTaskRecord; + // 获取旧的会员任务 MemberTask oldMemberTask = this.getById(merFollowMemberTaskDto.getTaskId()); - memberTaskRecord.setTaskId(merFollowMemberTaskDto.getTaskId()); - memberTaskRecord.setDelFlag(0); - memberTaskRecord.setUserId(merFollowMemberTaskDto.getUserId()); - memberTaskRecord.setFollowType(merFollowMemberTaskDto.getFollowType()); - memberTaskRecord.setCallPhone(merFollowMemberTaskDto.getCallPhone()); - memberTaskRecord.setCallTime(merFollowMemberTaskDto.getCallTime()); - memberTaskRecord.setFollowContent(merFollowMemberTaskDto.getFollowContent()); - memberTaskRecord.setCreateTime(new Date()); - memberTaskRecordService.saveOrUpdate(memberTaskRecord); - String picture = merFollowMemberTaskDto.getPicture(); - String video = merFollowMemberTaskDto.getVideo(); - String audio = merFollowMemberTaskDto.getAudio(); - String[] strArr; - TaskFile taskFile; - if(StringUtils.isNotBlank(picture)){ - strArr = picture.split(","); - for(String str : strArr){ - taskFile = new TaskFile(); - taskFile.setDelFlag(0); - taskFile.setFollowId(memberTaskRecord.getId()); - taskFile.setFollowFrom(2); - taskFile.setFileUrl(str); - taskFile.setFileType(1); - taskFileService.saveOrUpdate(taskFile); + oldMemberTask.setTaskStatus(2); + this.saveOrUpdate(oldMemberTask); + // 判断跟进类型 + if (merFollowMemberTaskDto.getFollowType() == 1) { + // 获取跟进电话列表 + List<MerFollowPhoneDto> followPhone = merFollowMemberTaskDto.getFollowPhone(); + // 判断跟进电话列表是否为空 + if (followPhone != null && !followPhone.isEmpty()) { + // 遍历跟进电话列表 + for (MerFollowPhoneDto followPhoneDto : followPhone) { + // 创建新的会员任务记录 + memberTaskRecord = new MemberTaskRecord(); + memberTaskRecord.setTaskId(merFollowMemberTaskDto.getTaskId()); + memberTaskRecord.setDelFlag(0); + memberTaskRecord.setUserId(merFollowMemberTaskDto.getUserId()); + memberTaskRecord.setFollowType(merFollowMemberTaskDto.getFollowType()); + memberTaskRecord.setCallPhone(merFollowMemberTaskDto.getCallPhone()); + memberTaskRecord.setFollowContent(followPhoneDto.getFollowContent()); + memberTaskRecord.setCallTime(followPhoneDto.getCallTime()); + // 保存或更新会员任务记录 + memberTaskRecordService.saveOrUpdate(memberTaskRecord); + } + } + } else { + // 创建新的会员任务记录 + memberTaskRecord = new MemberTaskRecord(); + memberTaskRecord.setTaskId(merFollowMemberTaskDto.getTaskId()); + memberTaskRecord.setDelFlag(0); + memberTaskRecord.setUserId(merFollowMemberTaskDto.getUserId()); + memberTaskRecord.setFollowType(merFollowMemberTaskDto.getFollowType()); + memberTaskRecord.setFollowContent(merFollowMemberTaskDto.getFollowContent()); + memberTaskRecord.setCreateTime(new Date()); + // 保存或更新会员任务记录 + memberTaskRecordService.saveOrUpdate(memberTaskRecord); + // 获取图片、视频和音频 + String picture = merFollowMemberTaskDto.getPicture(); + String video = merFollowMemberTaskDto.getVideo(); + String audio = merFollowMemberTaskDto.getAudio(); + String[] strArr; + TaskFile taskFile; + // 判断图片是否为空,并处理 + if (StringUtils.isNotBlank(picture)) { + strArr = picture.split(","); + for (String str : strArr) { + taskFile = new TaskFile(); + taskFile.setDelFlag(0); + taskFile.setFollowId(memberTaskRecord.getId()); + taskFile.setFollowFrom(2); + taskFile.setFileUrl(str); + taskFile.setFileType(1); + taskFileService.saveOrUpdate(taskFile); + } + } + // 判断视频是否为空,并处理 + if (StringUtils.isNotBlank(video)) { + strArr = picture.split(","); + for (String str : strArr) { + taskFile = new TaskFile(); + taskFile.setDelFlag(0); + taskFile.setFollowId(memberTaskRecord.getId()); + taskFile.setFollowFrom(2); + taskFile.setFileUrl(str); + taskFile.setFileType(2); + taskFileService.saveOrUpdate(taskFile); + } + } + // 判断音频是否为空,并处理 + if (StringUtils.isNotBlank(audio)) { + strArr = picture.split(","); + for (String str : strArr) { + taskFile = new TaskFile(); + taskFile.setDelFlag(0); + taskFile.setFollowId(memberTaskRecord.getId()); + taskFile.setFollowFrom(2); + taskFile.setFileUrl(str); + taskFile.setFileType(3); + taskFileService.saveOrUpdate(taskFile); + } } } - if(StringUtils.isNotBlank(video)){ - strArr = picture.split(","); - for(String str : strArr){ - taskFile = new TaskFile(); - taskFile.setDelFlag(0); - taskFile.setFollowId(memberTaskRecord.getId()); - taskFile.setFollowFrom(2); - taskFile.setFileUrl(str); - taskFile.setFileType(2); - taskFileService.saveOrUpdate(taskFile); - } - } - if(StringUtils.isNotBlank(audio)){ - strArr = picture.split(","); - for(String str : strArr){ - taskFile = new TaskFile(); - taskFile.setDelFlag(0); - taskFile.setFollowId(memberTaskRecord.getId()); - taskFile.setFollowFrom(2); - taskFile.setFileUrl(str); - taskFile.setFileType(3); - taskFileService.saveOrUpdate(taskFile); - } - } - if(StringUtils.isNotBlank(merFollowMemberTaskDto.getNextTaskDate())){ + // 判断下一个任务日期是否为空,并处理 + if (StringUtils.isNotBlank(merFollowMemberTaskDto.getNextTaskDate())) { MemberTask memberTask = new MemberTask(); String taskId = IdUtils.simpleUUID(); memberTask.setTaskId(taskId); diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskServiceImpl.java index 8548529..102f604 100644 --- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskServiceImpl.java +++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/task/ShopTaskServiceImpl.java @@ -55,10 +55,11 @@ shopTask.setShopId(mgtFollowShopTaskDto.getShopId()); shopTask.setFollowType(mgtFollowShopTaskDto.getFollowType()); shopTask.setNextFollowDate(DateUtils.toDate(LocalDate.now())); - shopTask.setTaskTitle(mgtFollowShopTaskDto.getNextTaskTitle()); + shopTask.setTaskTitle(mgtFollowShopTaskDto.getTaskTitle()); shopTask.setEmergencyState(mgtFollowShopTaskDto.getEmergencyState()); shopTask.setCreateTime(new Date()); shopTask.setTaskDate(DateUtils.toDate(LocalDate.now())); + shopTask.setTaskStatus(2); this.saveOrUpdate(shopTask); //创建任务记录 ShopTaskRecord shopTaskRecord = new ShopTaskRecord(); @@ -95,6 +96,7 @@ shopNextTask.setTaskTitle(mgtFollowShopTaskDto.getNextTaskTitle()); shopNextTask.setEmergencyState(mgtFollowShopTaskDto.getEmergencyState()); shopNextTask.setCreateTime(new Date()); + shopNextTask.setTaskStatus(0); try { shopNextTask.setNextFollowDate(DateUtils.parseDate(mgtFollowShopTaskDto.getNextTaskDate(),"yyyy-MM-dd")); shopNextTask.setTaskDate(DateUtils.parseDate(mgtFollowShopTaskDto.getNextTaskDate(),"yyyy-MM-dd")); diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/task/MemberTaskService.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/task/MemberTaskService.java index eddad99..3142801 100644 --- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/task/MemberTaskService.java +++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/task/MemberTaskService.java @@ -36,8 +36,11 @@ void createMemberTask(MerCreateMemberTaskDto merCreateMemberTaskDto); /** - * + * @description 会员任务跟进 + * @author jqs + * @date 2023/7/4 17:16 * @param merFollowMemberTaskDto + * @return void */ void followMemberTask(MerFollowMemberTaskDto merFollowMemberTaskDto); -- Gitblit v1.7.1