ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/domain/dto/MgtBasePlatformDto.java
@@ -3,6 +3,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.time.LocalDateTime; import java.util.List; /** @@ -50,4 +51,7 @@ @ApiModelProperty(value = "年龄层 1 <20,2 21-30,3 31-40,4 41-50,5 >50") private Integer ageType; private LocalDateTime startTime; private LocalDateTime endTime; } ruoyi-modules/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/order/OrderServiceImpl.java
@@ -93,6 +93,7 @@ import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.util.*; @@ -4041,7 +4042,7 @@ Map<Long, MgtSimpleShopVo> shopMap = null; Map<Long, MgtSimpleMemberVo> userMap = null; if (shopIdSet != null && !shopIdSet.isEmpty()) { String shopJoinedString = String.join(",", shopIdSet.stream().map(Object::toString).collect(Collectors.toList())); String shopJoinedString = String.join(",", shopIdSet.stream().filter(Objects::nonNull).map(Object::toString).collect(Collectors.toList())); MgtBaseBathDto mgtBaseBathDto = new MgtBaseBathDto(); mgtBaseBathDto.setIds(shopJoinedString); List<MgtSimpleShopVo> simpleShopVoList = remoteShopService.listShopSimpleVoByIds(mgtBaseBathDto).getData(); @@ -7305,6 +7306,11 @@ } mgtBasePlatformDto.setShopIdList(shopIdList); // 从数据库中获取第三方订单统计 DateTimeFormatter dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); mgtBasePlatformDto.setStartTime(LocalDate.parse(mgtBasePlatformDto.getStartDate(), dateFormatter) .atStartOfDay()); mgtBasePlatformDto.setEndTime(LocalDate.parse(mgtBasePlatformDto.getEndDate(), dateFormatter) .atTime(LocalTime.MAX)); vo = orderMapper.getPlTotalThirdOrderStatics(mgtBasePlatformDto); return vo; } ruoyi-modules/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml
@@ -1194,17 +1194,17 @@ <select id="getPlTotalOrderTotalOrderFrom" resultType="com.ruoyi.order.domain.vo.MgtTotalOrderTotalVo"> SELECT COUNT(order_id) orderTotal, IFNULL(SUM(CASE WHEN order_from in (1,5,6,7) THEN 1 ELSE 0 END),0) onlineTotal, IFNULL(SUM(CASE WHEN order_from = 1 THEN 1 ELSE 0 END),0) onlineTotal, IFNULL(SUM(CASE WHEN order_from = 3 THEN 1 ELSE 0 END),0) offlineTotal, IFNULL(SUM(CASE WHEN order_from = 2 THEN 1 ELSE 0 END),0) activityTotal, IFNULL(SUM(CASE WHEN order_from = 5 THEN 1 ELSE 0 END),0) meituan, IFNULL(SUM(CASE WHEN order_from = 5 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) meituanAmount, IFNULL(SUM(CASE WHEN order_from = 5 THEN receivable_money ELSE 0 END),0) meituanAmount, IFNULL(SUM(CASE WHEN order_from = 6 THEN 1 ELSE 0 END),0) douyin, IFNULL(SUM(CASE WHEN order_from = 6 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) douyinAmount, IFNULL(SUM(CASE WHEN order_from = 6 THEN receivable_money ELSE 0 END),0) douyinAmount, IFNULL(SUM(CASE WHEN order_from = 7 THEN 1 ELSE 0 END),0) kuaishou, IFNULL(SUM(CASE WHEN order_from = 7 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) kuaishouAmount, IFNULL(SUM(CASE WHEN order_from = 7 THEN receivable_money ELSE 0 END),0) kuaishouAmount, IFNULL(SUM(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END),0) orderMoney, IFNULL(SUM(CASE WHEN order_from in (1,5,6,7) THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) onlineMoney, IFNULL(SUM(CASE WHEN order_from = 1 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) onlineMoney, IFNULL(SUM(CASE WHEN order_from = 3 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) offlineMoney, IFNULL(SUM(CASE WHEN order_from = 2 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) activityMoney FROM t_order WHERE del_flag = 0 AND order_status = 3 @@ -1635,7 +1635,7 @@ <select id="getMerOrderTotalOrderFrom" resultType="com.ruoyi.order.domain.vo.MerOrderTotalVo"> SELECT COUNT(order_id) orderTotal, IFNULL(SUM(CASE WHEN order_from in (1,4,5,6,7) THEN 1 ELSE 0 END),0) onlineTotal, IFNULL(SUM(CASE WHEN order_from = 1 THEN 1 ELSE 0 END),0) onlineTotal, IFNULL(SUM(CASE WHEN order_from = 3 THEN 1 ELSE 0 END),0) offlineTotal, IFNULL(SUM(CASE WHEN order_from = 2 THEN 1 ELSE 0 END),0) activityTotal, IFNULL(SUM(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END),0) orderMoney, @@ -2222,7 +2222,7 @@ WHEN 7 THEN '快手' END orderFrom, tog.goods_name goodsName, IFNULL(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END,0) orderMoney, IFNULL(toc.receivable_money,0) orderMoney, toc.validity_time validityTime, CASE WHEN toc.order_status = 3 THEN toc.shop_id ELSE NULL END shopId, toc.use_time verifyTime @@ -2262,11 +2262,11 @@ IFNULL(SUM(CASE WHEN order_from = 7 THEN 1 ELSE 0 END), 0) AS kuaishou, IFNULL(SUM(CASE WHEN order_from = 8 THEN 1 ELSE 0 END), 0) AS xiaoeyun, -- 订单金额统计(取order_money) IFNULL(SUM(CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END),0) AS orderTotalMoney, IFNULL(SUM(CASE WHEN order_from = 5 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) meituanMoney, IFNULL(SUM(CASE WHEN order_from = 6 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) douyinMoney, IFNULL(SUM(CASE WHEN order_from = 7 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) kuaishouMoney, IFNULL(SUM(CASE WHEN order_from = 8 THEN (CASE WHEN null = change_receivable_money or change_receivable_money = 0 THEN receivable_money ELSE change_receivable_money END) ELSE 0 END),0) xiaoeyunMoney IFNULL(SUM(receivable_money),0) AS orderTotalMoney, IFNULL(SUM(CASE WHEN order_from = 5 THEN receivable_money ELSE 0 END),0) meituanMoney, IFNULL(SUM(CASE WHEN order_from = 6 THEN receivable_money ELSE 0 END),0) douyinMoney, IFNULL(SUM(CASE WHEN order_from = 7 THEN receivable_money ELSE 0 END),0) kuaishouMoney, IFNULL(SUM(CASE WHEN order_from = 8 THEN receivable_money ELSE 0 END),0) xiaoeyunMoney FROM t_order WHERE @@ -2279,5 +2279,8 @@ #{item} </foreach> </if> <if test="param.startTime!=null and param.endTime != null"> and create_time between #{param.startTime} and #{param.endTime} </if> </select> </mapper> ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/controller/management/MgtShopController.java
@@ -252,6 +252,12 @@ return R.ok(); } @RequestMapping(value = "/getRelUserShopNames", method = RequestMethod.GET) @ApiOperation(value = "获取关联账户已绑定门店【2.0】") public R<List<String>> getRelUserShop(@RequestParam Long userId) { return R.ok(shopService.getRelUserShop(userId)); } @RequestMapping(value = "/getMgtShopInfo", method = RequestMethod.POST) @ApiOperation(value = "获取商户详情【2.0】") public R<MgtShopInfoVo> getMgtShopInfo(@RequestBody MgtBaseGetDto mgtBaseGetDto) { ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/mapper/shop/ShopMapper.java
@@ -312,4 +312,7 @@ void updateShopByOneClinkSyncing(@Param("param") OneClinkSyncing oneClinkSyncing); List<Long> getShopListBySignAreaCodes(@Param("list")List<String> areaCodes); void updateBelongShopIdBatch(@Param("list")List<Long> shopIds, @Param("shopId")Long shopId); } ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
@@ -1998,6 +1998,21 @@ if (shop.getShopType()==2){ //经销商转加盟商: 先解绑该经销商下所有加盟商 shopMapper.setBelongShopIdNull(shopId); } else { //该加盟商所属区域下的加盟商 改为该新转换的经销商 List<String> areaCodes = Optional.ofNullable(shop.getSignAreaCode()) .map(codes -> codes.split(";")) .map(Arrays::asList) .orElse(Collections.emptyList());//签约区域 if (!areaCodes.isEmpty()){ // 1. 查询符合条件的加盟商列表 List<Long> shopIds = shopMapper.getShopListBySignAreaCodes(areaCodes); // 2. 批量更新(优化性能,避免循环中单条更新) if(null != shopIds && !shopIds.isEmpty()){ shopMapper.updateBelongShopIdBatch(shopIds,shop.getShopId()); } } } shop.setUpdateUserId(SecurityUtils.getUserId()); shopMapper.updateById(shop); @@ -2052,11 +2067,24 @@ .setDelFlag(0)); } } shopFileService.saveBatch(coverUrlList); shopFileService.saveBatch(bannerList); //批量修改门店信息 oneClinkSyncing.setShopIdList(shopIdList); shopMapper.updateShopByOneClinkSyncing(oneClinkSyncing); return R.ok(); } @Override public List<String> getRelUserShop(Long userId) { List<ShopRelUser> shopRelUserList = shopRelUserService.getByUserId(userId); List<Long> shopIds = shopRelUserList.stream().map(ShopRelUser::getShopId).collect(Collectors.toList()); if(!shopIds.isEmpty()){ List<Shop> shops = shopMapper.selectList(new LambdaQueryWrapper<Shop>() .ne(Shop::getShopStatus,-1) .in(Shop::getShopId,shopIds)); return shops.stream().map(Shop::getShopName).collect(Collectors.toList()); } return null; } } ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/shop/ShopService.java
@@ -489,4 +489,6 @@ * 一键同步商户信息 */ R updateShopByOneClinkSyncing(OneClinkSyncing oneClinkSyncing); List<String> getRelUserShop(Long userId); } ruoyi-modules/ruoyi-shop/src/main/resources/mapper/shop/ShopMapper.xml
@@ -597,7 +597,7 @@ FROM t_shop WHERE del_flag = 0 AND shop_status = 1 <if test="param.cityCodeList !=null and param.cityCodeList.size()>0" > AND shop_city_code IN AND shop_area_code IN <foreach collection="param.cityCodeList" item="item" open="(" separator="," close=")"> #{item} </foreach> @@ -1194,6 +1194,15 @@ #{id} </foreach> </update> <update id="updateBelongShopIdBatch"> UPDATE t_shop SET belong_shop_id = #{shopId}, update_time = NOW() WHERE shop_id IN <foreach collection="list" item="shopId" open="(" separator="," close=")"> #{shopId} </foreach> </update> <select id="listShopIdByCityCode" resultType="java.lang.Long"> SELECT shop_id @@ -1284,5 +1293,22 @@ </if> </select> <select id="getShopListBySignAreaCodes" resultType="java.lang.Long"> SELECT shop_id FROM t_shop WHERE del_flag = 0 and shop_type = 2 AND shop_status != -1 <if test="list != null and list.size() > 0"> AND ( <foreach collection="list" item="code" separator=" OR "> sign_area_code = #{code} OR sign_area_code LIKE CONCAT(#{code}, ';%') OR sign_area_code LIKE CONCAT('%;', #{code}, ';%') OR sign_area_code LIKE CONCAT('%;', #{code}) </foreach> ) </if> </select> </mapper> ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/MgtOneClinkSyncingPageDTO.java
@@ -1,5 +1,6 @@ package com.ruoyi.system.domain.dto; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.system.api.domain.dto.MgtPageDto; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -18,8 +19,10 @@ private String syncingName; @ApiModelProperty(value = "操作同步时间范围-开始时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime syncingStartTime; @ApiModelProperty(value = "操作同步时间范围-结束时间") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") private LocalDateTime syncingEndTime; } ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/domain/vo/MgtOneClinkSyncingVO.java
@@ -22,11 +22,11 @@ private String detailsPicture; @ApiModelProperty("领券1开2关") private String platformCouponFlag; private Integer platformCouponFlag; @ApiModelProperty("生日卡1开2关") private String platformBirthdayFlag; private Integer platformBirthdayFlag; @ApiModelProperty("店铺详情") private String shopDetail;