From 51d2b3cf83f14ae8a18ae13bd2fa723dbcae381c Mon Sep 17 00:00:00 2001 From: winter Date: Thu, 20 Jan 2022 14:31:37 +0800 Subject: [PATCH] =?UTF-8?q?fix=20wxMerchant=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/WxMerchantController.java | 6 +- .../mem/WxCUserBasicInfoController.java | 20 +- .../db/migration/V2022012000001__optimize.sql | 201 ++++++++ .../controller/WxRefundOrderController.java | 2 +- .../controller/WxMerchantController.java | 2 +- .../iformall/service/impl/PosServiceImpl.java | 46 +- .../schedule/DaliyAmountSchedule.java | 6 +- .../com/iformall/domain/po/WxCouponOrder.java | 4 + .../com/iformall/domain/po/WxMerchant.java | 3 + .../iformall/domain/po/WxMerchantBUser.java | 2 + .../java/com/iformall/domain/po/WxShop.java | 3 + .../com/iformall/domain/vo/WxMerchantVo.java | 21 + .../iformall/mapper/WxCouponOrderMapper.java | 4 + .../mapper/WxMerchantBUserMapper.java | 1 + .../com/iformall/mapper/WxMerchantMapper.java | 22 +- .../mapper/WxProfitSharingReceiverMapper.java | 2 +- .../iformall/mapper/WxRentContractMapper.java | 32 +- .../com/iformall/mapper/WxShopMapper.java | 2 - .../service/WxCouponOrderService.java | 2 + .../iformall/service/WxMerchantService.java | 11 +- .../service/WxRefundOrderService.java | 3 +- .../com/iformall/service/WxShopService.java | 4 +- .../service/impl/WxBillAllServiceImpl.java | 21 +- .../service/impl/WxChartServiceImpl.java | 26 +- .../impl/WxCouponOrderServiceImpl.java | 270 ++++++---- .../service/impl/WxCouponServiceImpl.java | 26 +- .../service/impl/WxMerchantServiceImpl.java | 442 ++++++++++++++--- .../impl/WxMerchantTradeDailyServiceImpl.java | 4 +- .../WxProfitSharingReceiverServiceImpl.java | 17 +- .../impl/WxRefundOrderServiceImpl.java | 19 +- .../service/impl/WxShopServiceImpl.java | 13 +- .../resources/mapper/WxCouponOrderMapper.xml | 114 ++++- .../mapper/WxMerchantBUserMapper.xml | 10 + .../resources/mapper/WxMerchantMapper.xml | 461 +++--------------- .../mapper/WxProfitSharingReceiverMapper.xml | 8 +- .../resources/mapper/WxRentContractMapper.xml | 298 +---------- .../main/resources/mapper/WxShopMapper.xml | 31 +- .../basic/WxMerchantController.java | 6 +- .../controller/WxMerchantController.java | 2 +- 39 files changed, 1120 insertions(+), 1047 deletions(-) create mode 100644 mallinkAdmin/src/main/resources/db/migration/V2022012000001__optimize.sql diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java index 233a48159..4c3955b6e 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java @@ -57,7 +57,7 @@ public class WxMerchantController extends BaseController { if (null == wxMerchant) wxMerchant = new WxMerchant(); wxMerchant.updateTenantInfo(getTenantInfo()); wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); - final PageInfo page = wxMerchantService.listVoAsPage(wxMerchant, pageNum, pageSize); + final PageInfo page = wxMerchantService.listVoAsPage(wxMerchant, pageNum, pageSize,true); return new ResultData(page); } @@ -74,7 +74,7 @@ public class WxMerchantController extends BaseController { if (null == wxMerchant) wxMerchant = new WxMerchant(); wxMerchant.updateTenantInfo(getTenantInfo()); wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); - final PageInfo page = wxMerchantService.listVoAsPage2(wxMerchant, pageNum, pageSize); + final PageInfo page = wxMerchantService.listVoAsPage(wxMerchant, pageNum, pageSize,false); return new ResultData(page); } @@ -240,7 +240,7 @@ public class WxMerchantController extends BaseController { @SystemControllerLog(description = "商户-查询") public ResultData findMerchantById(Long id) { logger.debug("[" + getIpAddr() + "] WxMerchantController::findMerchantById"); - WxMerchantVo wxMerchant = wxMerchantService.findMerchantById(id); + WxMerchantVo wxMerchant = wxMerchantService.findMerchantById(getTenantInfo(),id); return new ResultData(wxMerchant); } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java index 4043d2df1..8d5235503 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/WxCUserBasicInfoController.java @@ -17,6 +17,7 @@ import com.iformall.domain.vo.UserTradeRecordVo; import com.iformall.enums.EnumAssignTagsTrigger; import com.iformall.enums.EnumCouponOrderStatus; import com.iformall.exception.MallinkException; +import com.iformall.mapper.WxCouponMerchantMapper; import com.iformall.mapper.WxMerchantMapper; import com.iformall.service.*; import com.iformall.utils.Constant; @@ -91,6 +92,9 @@ public class WxCUserBasicInfoController extends BaseController { @Autowired private WxCreditHistoryService wxCreditHistoryService; + + @Autowired + WxCouponMerchantMapper wxCouponMerchantMapper; private void updateLevelParam(WxCUserBasicInfo info) { List levelList = wxLevelConfigService.getByTenantInfo(ifParentUpdateTenantInfo()); @@ -301,11 +305,17 @@ public class WxCUserBasicInfoController extends BaseController { c.setSalePrice(coupon.getPrice()); if(c.getCouponId() != null) { - HashMap param = new HashMap<>(); - param.put("id", c.getCouponId() + ""); - WxMerchant w = wxMerchantMapper.findByTrade(param); - if (w != null) - c.setMerchantName(w.getName()); + List couponIds = new ArrayList(); + couponIds.add(c.getCouponId()); + List merchantIds = wxCouponMerchantMapper.findMerchantByProductIds(corder.getTenantId(), couponIds); + if (null != merchantIds && merchantIds.size() > 0 ) { + Map param = new HashMap(); + param.put("ids", merchantIds); + WxMerchant w = wxMerchantMapper.findByTrade(param); + if (w != null) { + c.setMerchantName(w.getName()); + } + } } } } diff --git a/mallinkAdmin/src/main/resources/db/migration/V2022012000001__optimize.sql b/mallinkAdmin/src/main/resources/db/migration/V2022012000001__optimize.sql new file mode 100644 index 000000000..9bedfeff7 --- /dev/null +++ b/mallinkAdmin/src/main/resources/db/migration/V2022012000001__optimize.sql @@ -0,0 +1,201 @@ +alter table wx_coupon_order_0 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_1 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_2 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_3 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_4 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_5 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_6 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_7 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_8 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_9 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_10 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_11 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_12 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_13 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_14 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_15 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_16 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_17 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_18 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_19 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_20 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_21 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_22 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_23 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_24 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_25 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_26 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_27 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_28 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_29 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_30 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_31 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_32 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_33 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_34 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_35 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_36 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_37 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_38 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_39 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_40 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_41 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_42 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_43 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_44 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_45 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_46 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_47 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_48 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_49 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_50 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_51 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_52 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_53 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_54 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_55 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_56 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_57 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_58 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_59 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_60 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_61 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_62 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_63 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_64 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_65 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_66 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_67 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_68 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_69 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_70 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_71 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_72 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_73 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_74 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_75 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_76 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_77 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_78 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_79 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_80 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_81 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_82 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_83 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_84 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_85 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_86 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_87 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_88 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_89 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_90 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_91 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_92 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_93 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_94 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_95 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_96 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_97 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_98 add column b_merchant_id bigint(20) AFTER `b_user_id`; +alter table wx_coupon_order_99 add column b_merchant_id bigint(20) AFTER `b_user_id`; + +UPDATE wx_coupon_order_0 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_1 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_2 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_3 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_4 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_5 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_6 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_7 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_8 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_9 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_10 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_11 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_12 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_13 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_14 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_15 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_16 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_17 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_18 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_19 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_20 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_21 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_22 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_23 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_24 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_25 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_26 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_27 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_28 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_29 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_30 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_31 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_32 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_33 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_34 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_35 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_36 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_37 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_38 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_39 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_40 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_41 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_42 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_43 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_44 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_45 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_46 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_47 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_48 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_49 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_50 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_51 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_52 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_53 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_54 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_55 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_56 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_57 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_58 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_59 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_60 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_61 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_62 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_63 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_64 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_65 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_66 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_67 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_68 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_69 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_70 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_71 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_72 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_73 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_74 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_75 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_76 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_77 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_78 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_79 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_80 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_81 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_82 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_83 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_84 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_85 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_86 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_87 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_88 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_89 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_90 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_91 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_92 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_93 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_94 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_95 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_96 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_97 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_98 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; +UPDATE wx_coupon_order_99 co, wx_merchant_b_user bu SET co.`b_merchant_id` = bu.`merchant_id` WHERE co.`b_user_id` = bu.`id`; diff --git a/mallinkBApi/src/main/java/com/iformall/controller/WxRefundOrderController.java b/mallinkBApi/src/main/java/com/iformall/controller/WxRefundOrderController.java index a40af5662..43be19cb3 100644 --- a/mallinkBApi/src/main/java/com/iformall/controller/WxRefundOrderController.java +++ b/mallinkBApi/src/main/java/com/iformall/controller/WxRefundOrderController.java @@ -73,7 +73,7 @@ public class WxRefundOrderController extends BaseController { appinfo = wxAppinfoService.getList(appinfo).get(0); // WxAppinfo appinfo = getAppInfo(bUser.getAppId()); try { - ResultData rd = wxRefundOrderService.createRefundOrder(appinfo, couponOrderId, EnumPayType.PAY_B_REFUND, bUser.getId(), null); + ResultData rd = wxRefundOrderService.createRefundOrder(appinfo, couponOrderId, EnumPayType.PAY_B_REFUND, bUser, null); return rd; } catch (MallinkException e) { logger.error(e.getMessage()); diff --git a/mallinkCApi/src/main/java/com/iformall/controller/WxMerchantController.java b/mallinkCApi/src/main/java/com/iformall/controller/WxMerchantController.java index 5a6c6d5c4..779151ce7 100644 --- a/mallinkCApi/src/main/java/com/iformall/controller/WxMerchantController.java +++ b/mallinkCApi/src/main/java/com/iformall/controller/WxMerchantController.java @@ -43,7 +43,7 @@ public class WxMerchantController extends BaseController { wxMerchantDto.updateTenantInfo(getTenantInfo()); wxMerchantDto.setMerchantStatus(EnumMerchantStatus.VALID.getCode()); wxMerchantDto.setIsPublic(EnumMerchantPublic.PUBLIC.getCode()); - return new ResultData(wxMerchantService.listAsPageCVo(wxMerchantDto, pageNum, pageSize)); + return new ResultData(wxMerchantService.listAsPageCVo(wxMerchantDto, pageNum, pageSize,true)); } @ApiOperation("根据code查询接口") diff --git a/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java b/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java index 6be694119..5d2723063 100644 --- a/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java +++ b/mallinkPosApi/src/main/java/com/iformall/service/impl/PosServiceImpl.java @@ -1213,50 +1213,7 @@ public class PosServiceImpl implements PosService { throw new MallinkException(ErrorCode.POS_COUPON_REFUND_ERROR.getCode(), errMessage); } - /** - * 预核销 - * @param buUserId - * @param couponOrderCVo - * @param posOrderId - */ - private void doPreVerify(WxCouponOrderCVo couponOrderCVo, Long buUserId, Long posOrderId) { - int num = 0; - // 1. insert posOrderId - PosCouponOrderVerify posCouponOrderVerify = new PosCouponOrderVerify(); - posCouponOrderVerify.updateTenantInfo(couponOrderCVo); - posCouponOrderVerify.setCouponOrderId(couponOrderCVo.getId()); - posCouponOrderVerify.setPosOrderId(posOrderId); - posCouponOrderVerify.setOrderFrom(EnumOrderFrom.POS.getCode()); - posCouponOrderVerify.setState(EnumEnableType.Enable.getCode()); - posCouponOrderVerify.setCreateDate(new Date()); - posCouponOrderVerify.setUpdateDate(new Date()); - try { - posCouponOrderVerifyService.saveOrUpdate(posCouponOrderVerify); - } catch (Exception e) { - logger.error("db failed: couponOrder-" + couponOrderCVo.getId() + ", e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - - // 2. update couponOrder - try { - WxCouponOrder couponOrder = new WxCouponOrder(); - couponOrder.setId(couponOrderCVo.getId()); - couponOrder.updateTenantInfo(couponOrderCVo); - couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.POS_PRE_VERIFY.getCode()); - couponOrder.setBUserId(buUserId); - couponOrder.setVerifyType(EnumCouponVerifyType.VERIFY_POS_PAY.getCode()); - couponOrder.setUpdateDate(new Date()); - num = couponOrderMapper.updateVerifyCouponOrder(couponOrder); - } catch (Exception e) { - logger.error("db failed: couponOrder-" + couponOrderCVo.getId() + ", e:" + e.getMessage()); - throw new MallinkException(ErrorCode.DB_FAIL.getCode(), "DB FAILD " + e.getMessage()); - } - if (num != 1) { - logger.error("预核销异常:updatete num " + num); - throw new MallinkException(ErrorCode.VERIFY_ERROR.getCode(), "updatete num " + num); - } - logger.info("预核销已完成: " + couponOrderCVo.getId()); - } + /** * 预核销回退 @@ -1344,6 +1301,7 @@ public class PosServiceImpl implements PosService { couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.POS_PRE_VERIFY.getCode()); } couponOrder.setBUserId(buUserId); + couponOrder.setBMerchantId(merchantId); couponOrder.setUpdateDate(curDate); if (couponOrderCVo.getBUserId() == null) { num = couponOrderMapper.updateVerifyCouponOrder(couponOrder); diff --git a/mallinkSchedule/src/main/java/com/iformall/schedule/DaliyAmountSchedule.java b/mallinkSchedule/src/main/java/com/iformall/schedule/DaliyAmountSchedule.java index f4fc4aabe..478faa4dc 100644 --- a/mallinkSchedule/src/main/java/com/iformall/schedule/DaliyAmountSchedule.java +++ b/mallinkSchedule/src/main/java/com/iformall/schedule/DaliyAmountSchedule.java @@ -99,11 +99,7 @@ public class DaliyAmountSchedule { dateMap.put("endDate", endDate); dateMap.put("merchantId", merchant.getId()); dateMap.put("tenantId", merchant.getTenantId()); - WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); - merchantBUserQ.updateTenantInfo(merchant); - merchantBUserQ.setMerchantId(merchant.getId()); - List bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); - dateMap.put("bUserIdList", bUserIds); + dateMap.put("bMerchantId", merchant.getId()); list = wxCouponOrderMapper.findListOfVerifiedByDate(dateMap); if (null != list && list.size() > 0) { logger.info("\nfind " + list.size() + " coupon order from " + startDate + " to " + endDate); diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java index d932a3eef..61d7a5292 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCouponOrder.java @@ -36,6 +36,10 @@ public class WxCouponOrder extends TenantEntity { private Long bUserId; @TableField(exist = false) private List bUserIdList; + @io.swagger.annotations.ApiModelProperty(value = "操作券B端小程序用户商户ID", name = "bMerchantId") + private Long bMerchantId; + @TableField(exist = false) + private List bMerchantIdList; @io.swagger.annotations.ApiModelProperty(value = "操作券A端用户ID", name = "aUserId") private Long aUserId; @io.swagger.annotations.ApiModelProperty(value = "用户订单ID", name = "orderId") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java index 0cc59c3ae..f0eabb299 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchant.java @@ -27,6 +27,9 @@ import java.util.stream.Collectors; public class WxMerchant extends TenantEntity { protected Long id; + + @TableField(exist = false) + private List notInids; @TableField(exist = false) private List userids; diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchantBUser.java b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchantBUser.java index 248f165bc..afe88b928 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxMerchantBUser.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxMerchantBUser.java @@ -21,6 +21,8 @@ public class WxMerchantBUser extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "B端用户手机号", name = "phone") private String phone; + @TableField(exist = false) + private String phoneLike; @io.swagger.annotations.ApiModelProperty(value = "", name = "userPwd") private String userPwd; @io.swagger.annotations.ApiModelProperty(value = "商户id", name = "merchantId") diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxShop.java b/mallinkService/src/main/java/com/iformall/domain/po/WxShop.java index 4a1b7635f..9a6746305 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxShop.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxShop.java @@ -33,6 +33,9 @@ public class WxShop extends TenantEntity { @TableField(exist = false) private String merchantName; + + @TableField(exist = false) + private String floorForRule; @Excel(name="类型",width = 20,orderNum = "1", diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantVo.java b/mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantVo.java index 4967d2d20..230c497e1 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantVo.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/WxMerchantVo.java @@ -1,6 +1,7 @@ package com.iformall.domain.vo; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.iformall.domain.po.WxMerchant; import com.iformall.domain.po.base.TenantEntity; import lombok.Data; import lombok.EqualsAndHashCode; @@ -97,4 +98,24 @@ public class WxMerchantVo extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value = "置顶时间", name = "topTime") private Date topTime; + + public void initByMerchant(WxMerchant m) { + this.id = m.getId(); + this.merchantImgUrl = m.getImgUrl(); + this.merchantName = m.getName(); + this.merchantEncode = m.getEncode(); + this.merchantLinkPhone = m.getLinkPhone(); + this.merchantStatus = m.getStatus(); + this.businessId = m.getBusinessId(); + this.isPublic = m.getIsPublic(); + this.email = m.getEmail(); + this.title = m.getTitle(); + this.coverPicture = m.getCoverPicture(); + this.subBusinessId = m.getSubBusinessId(); + this.shopType = m.getShopType(); + this.introduction = m.getIntroduction(); + this.actionDesc = m.getActionDesc(); + this.linkLinePhone = m.getLinkLinePhone(); + this.topTime = m.getTopTime(); + } } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java index c7e2a1c4a..f57c48533 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java @@ -98,5 +98,9 @@ public interface WxCouponOrderMapper extends CommonMapper { Integer findWriteOffCount(WxCouponOrder wxCouponOrder); List findGoodsList(WxCouponOrderBVo record); + + List findMerchantUserTradeList(Map params); + + List findUserTradeList(WxCouponOrder wxCouponOrder); } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxMerchantBUserMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxMerchantBUserMapper.java index b967ba478..3910709b6 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxMerchantBUserMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxMerchantBUserMapper.java @@ -9,6 +9,7 @@ public interface WxMerchantBUserMapper extends CommonMapper findList(WxMerchantBUser wxMerchantBUser); List findIdList(WxMerchantBUser wxMerchantBUser); + List findMerchantIdList(WxMerchantBUser wxMerchantBUser); List findSimpleList(WxMerchantBUser wxMerchantBUser); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java index 7713d3044..53b1283d9 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxMerchantMapper.java @@ -20,10 +20,8 @@ public interface WxMerchantMapper extends CommonMapper { List findIdNameList(WxMerchant wxMerchant); - List findListCVo(WxMerchantDto wxMerchantDto); - WxMerchantVo getMerchantByCode(HashMap params); - - WxMerchant queryMerchantByMerchantIdOfSharingReceiver(WxMerchant wxMerchant); + List findListCVo(WxMerchantDto wxMerchantDto); + WxMerchant getMerchantByCode(HashMap params); List findQrcodeEmptyList(); @@ -32,17 +30,11 @@ public interface WxMerchantMapper extends CommonMapper { int hasMerchant(WxMerchant wxMerchant); int hasMerchantEncode(WxMerchant wxMerchant); - List findListVo(WxMerchant record); - void updateCreditLocked(WxMerchant wxMerchant); - List userTradeList(WxMerchant wxMerchant); - - List userTradeDetailList(WxMerchant wxMerchant); + List userTradeMerchantList(WxMerchant wxMerchant); - WxMerchant findByTrade(HashMap params); - - List findListVo2(WxMerchant record); + WxMerchant findByTrade(Map params); List getMerchantList(WxMerchant wxMerchant); @@ -58,8 +50,8 @@ public interface WxMerchantMapper extends CommonMapper { int recordedAmount(WxMerchant record); - List> findMerchantByShop(@Param("shopId")Long shopId); - - List> detailByShopId(@Param("tenantInfo")TenantEntity tenantInfo,@Param("shopId") Long shopId); + Map detailShopMerchantById(@Param("tenantInfo")TenantEntity tenantInfo,@Param("id") Long id); + + Map findShopMerchant(@Param("id")Long id); } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxProfitSharingReceiverMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxProfitSharingReceiverMapper.java index bbe991bdd..bca55de5b 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxProfitSharingReceiverMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxProfitSharingReceiverMapper.java @@ -8,7 +8,7 @@ public interface WxProfitSharingReceiverMapper extends CommonMapper findList(WxProfitSharingReceiver wxProfitSharingReceiver); - + WxProfitSharingReceiver findOne(WxProfitSharingReceiver wxProfitSharingReceiver); diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java index 7c67f7b0d..5723998a4 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxRentContractMapper.java @@ -16,36 +16,12 @@ public interface WxRentContractMapper extends CommonMapper List findList(WxRentContract wxRentContract); - //List> queryRentContractData(WxRentContract wxRentContract); - - //int queryRentContractWaitSignStatus(WxRentContract wxRentContract); - - //int queryRentContractEndSoonStatus(WxRentContract wxRentContract); - - //int queryRentContractPaidStatus(WxRentContract wxRentContract); - int queryRentContractCountByStatus(WxRentContract wxRentContract); - - //int queryRentContractEndStatus(WxRentContract wxRentContract); - - //int updateRentContractEndSoonStatus(WxRentContract wxRentContract); - - //int updateRentContractPaidStatus(WxRentContract wxRentContract); - - //int updateRentContractEndStatus(WxRentContract wxRentContract); - - //void updateRentWaitSignStatus(WxRentContract wxRentContract); - - //void updateRentInvalidStatus(WxRentContract wxRentContract); - - //List getRentContractList(WxRentContract wxRentContract); void updateStatusForUnsign(WxRentContract wxRentContract); void updateApplyStatus(WxRentContract wxRentContract); - //List getRentInvalidList(WxRentContract wxRentContract); - void updateStatus(WxRentContract wxRentContract); long queryOweCount(WxRentContract wxRentContract); @@ -54,23 +30,16 @@ public interface WxRentContractMapper extends CommonMapper int selectRentContractCountByShopId(@Param("tenantId") String tenantId,@Param("parentTenantId") String parentTenantId,@Param("shopId") Long shopId,@Param("id") Long id); - //void updateInvalidContract(WxRentContract record); - List selectRentContractByMerchantId(WxRentContract wxRentContract); List selectRentContractByShopId(@Param("tenantId") String tenantId,@Param("parentTenantId") String parentTenantId,@Param("shopId") Long shopId,@Param("status") Integer status); - //List selectRentContractByShopIds(@Param("shopIds") Collection shopIds,@Param("shopIdsRegexp") String shopIdsRegexp,@Param("tenantId") String tenantId,@Param("parentTenantId") String parentTenantId); - int hasContractNumber(WxRentContract wxRentContract); - //Integer getShopType(WxRentContract wxRentContract); - List listContractVo(WxRentPropertyContractVo record); WxRentContract getByBill(WxBillRent billRent); - //int selectContractCountByShopId(WxRentContract wxRentContract); int getShopCountMax(); List> queryContractByBus(WxBusiness wxBusiness); @@ -89,4 +58,5 @@ public interface WxRentContractMapper extends CommonMapper List> findRentByShop(@Param("shopId")Long shopId); List> currentValidByMerchantId(WxRentContract rentContract); + } diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java index f277fc19e..3e25a92bf 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxShopMapper.java @@ -35,8 +35,6 @@ public interface WxShopMapper extends CommonMapper { List findListWithMerchantMap(WxShop record); - List findShopVoList(@Param("merchantId") Long merchantId); - Long getCountByWxShop(WxShop wxShop); List> rentRateHistory(Map params); diff --git a/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java b/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java index 662eb4b9e..7df739ca1 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxCouponOrderService.java @@ -222,5 +222,7 @@ public interface WxCouponOrderService { List findAvailCouponOrder(TenantEntity tenantEntity,Long cUserId,Long merchantId,Long posOrderId); + PageInfo userTradeDetailList(WxMerchant wxMerchant,Date startTime,Date endTime,Integer pageIndex,Integer pageSize); + } diff --git a/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java b/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java index 96aba3c73..cc6742024 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxMerchantService.java @@ -66,7 +66,8 @@ public interface WxMerchantService { List queryIdAndNames(WxMerchant record); - PageInfo listAsPageCVo(WxMerchantDto record, Integer pageIndex, Integer pageSize); + + PageInfo listAsPageCVo(WxMerchantDto wxMerchantDto, Integer pageIndex, Integer pageSize,boolean hasShop); /** * 根据code查询 * @@ -136,7 +137,7 @@ public interface WxMerchantService { ResultData updateMerchantLevel(WxMerchant wxMerchant); - WxMerchantVo findMerchantById(Long id); + WxMerchantVo findMerchantById(TenantEntity tenantEntity,Long id); WxMerchant findOne(WxMerchant wxMerchant); @@ -153,13 +154,11 @@ public interface WxMerchantService { Optional findByName(String name); - PageInfo listVoAsPage(WxMerchant wxMerchant, Integer pageNum, Integer pageSize); + PageInfo listVoAsPage(WxMerchant wxMerchant, Integer pageNum, Integer pageSize,boolean hasRentContractInfo); List findMerchantVoList(Long couponId,TenantEntity tenantEntity,boolean hasShop); Map> findCouponMerchantVoList(List couponIds,TenantEntity tenantEntity,boolean hasShop); - PageInfo listVoAsPage2(WxMerchant wxMerchant, Integer pageNum, Integer pageSize); - List getMerchantList(WxMerchant wxMerchant); void disableMerchat(Long id); @@ -182,5 +181,7 @@ public interface WxMerchantService { Map findMerchantByShop(Long shopId); Map detailByShopId(TenantEntity tenantInfo, Long shopId); + + List getFloorBuildMerchantIds(TenantEntity tenantEntity,String floorRule,Long building,Long floor,Integer merchantShopDel,Integer shopDel ) ; } diff --git a/mallinkService/src/main/java/com/iformall/service/WxRefundOrderService.java b/mallinkService/src/main/java/com/iformall/service/WxRefundOrderService.java index 00ecf0440..ba2f4f042 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxRefundOrderService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxRefundOrderService.java @@ -3,6 +3,7 @@ package com.iformall.service; import com.github.pagehelper.PageInfo; import com.iformall.common.ResultData; import com.iformall.domain.po.WxAppinfo; +import com.iformall.domain.po.WxMerchantBUser; import com.iformall.domain.po.WxRefundOrder; import com.iformall.enums.EnumPayType; import com.iformall.enums.EnumPayWay; @@ -20,7 +21,7 @@ public interface WxRefundOrderService { * @param bUserId b端退款Id,auto,admin,self可为null * @return */ - ResultData createRefundOrder(WxAppinfo appInfo, Long couponOrderId, EnumPayType payType, Long bUserId, Long aUserId); + ResultData createRefundOrder(WxAppinfo appInfo, Long couponOrderId, EnumPayType payType, WxMerchantBUser bUser, Long aUserId); /** * 创建退款订单 diff --git a/mallinkService/src/main/java/com/iformall/service/WxShopService.java b/mallinkService/src/main/java/com/iformall/service/WxShopService.java index ec4877f8c..b87ca9630 100644 --- a/mallinkService/src/main/java/com/iformall/service/WxShopService.java +++ b/mallinkService/src/main/java/com/iformall/service/WxShopService.java @@ -93,5 +93,7 @@ public interface WxShopService { * @param merchantId * @return */ - Map> findMerchantShopVoList(TenantEntity tenantEntity, List merchantIds); + Map> findMerchantShopVoListMap(TenantEntity tenantEntity, List merchantIds); + List findMerchantShopVoList(TenantEntity tenantEntity,Long merchantId); + } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java index 22e1ae0d5..8769ec6bc 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxBillAllServiceImpl.java @@ -28,6 +28,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; @@ -49,24 +50,31 @@ public class WxBillAllServiceImpl implements WxBillAllService { @Autowired WxBillAllMapper wxBillAllMapper; + @Lazy @Autowired WxBillDailyService wxBillDailyService; + @Lazy @Autowired WxBillDepositService wxBillDepositService; + @Lazy @Autowired WxBillPropertyDepositService wxBillPropertyDepositService; + @Lazy @Autowired WxBillPropertyService wxBillPropertyService; + @Lazy @Autowired WxBillRentService wxBillRentService; + @Lazy @Autowired WxBillOtherService wxBillOtherService; + @Lazy @Autowired WxBillOtherDepositService wxBillOtherDepositService; @@ -97,6 +105,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { @Autowired MqBaseProducer mqBaseProducer; + @Lazy @Autowired WxBillActionService wxBillActionService; @@ -107,7 +116,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { WxMallMapper wxMallMapper; @Autowired - WxMerchantMapper wxMerchantMapper; + WxMerchantService wxMerchantService; @Autowired private String fmUploadDir; @@ -124,14 +133,18 @@ public class WxBillAllServiceImpl implements WxBillAllService { @Autowired StringRedisTemplate stringRedisTemplate; + @Lazy @Autowired WxBillSettleRecordService wxBillSettleRecordService; + @Lazy @Autowired WxBillSettleService wxBillSettleService; @Autowired WxBillSettleRecordMapper wxBillSettleRecordMapper; + + @Lazy @Autowired WxPayAccountBillService wxPayAccountBillService; @@ -843,7 +856,9 @@ public class WxBillAllServiceImpl implements WxBillAllService { WxMerchantDto wxMerchantDto = new WxMerchantDto(); wxMerchantDto.setId(wxBillAll.getMerchantId()); - List listCVo = wxMerchantMapper.findListCVo(wxMerchantDto); + wxMerchantDto.updateTenantInfo(wxMall); + PageInfo pageInfo = wxMerchantService.listAsPageCVo(wxMerchantDto,1,1,true); + List listCVo = pageInfo.getList(); WxMerchantVo wxMerchantVo = listCVo.get(0); result.put("merchant", wxMerchantVo.getMerchantName()); WxShopVo wxShopVo = wxMerchantVo.getShopVoList().stream() @@ -904,7 +919,7 @@ public class WxBillAllServiceImpl implements WxBillAllService { // q.setTenantInfo(wxBillSettle); WxMall wxMall = wxMallMapper.getByTenantInfo(wxBillSettle); result.put("mall", wxMall.getName()); - result.put("merchant", wxMerchantMapper.selectById(wxBillSettle.getMerchantId()).getName()); + result.put("merchant", wxMerchantService.selectById(wxBillSettle.getMerchantId()).getName()); result.put("num", wxBillSettle.getSettleNumber()); result.put("cdate", DateUtils.format(wxBillSettle.getCreatetime())); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java index 201e77985..b6c109f23 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxChartServiceImpl.java @@ -47,8 +47,14 @@ public class WxChartServiceImpl implements WxChartDataService { WxShopMapper wxShopMapper; @Autowired WxBillRentMapper wxBillRentMapper; + + @Lazy + @Autowired + WxMerchantService wxMerchantService; + @Autowired WxMerchantMapper wxMerchantMapper; + @Autowired WxMerchantTradeDailyMapper wxMerchantTradeDailyMapper; @Autowired @@ -646,20 +652,34 @@ public class WxChartServiceImpl implements WxChartDataService { */ private ResultData getBusiness(TenantEntity tenantEntity,Map paramsMap){ Map resultMap = new LinkedMap(); + Map bussnessNameMap = new HashMap(); List businessList = wxBusinessService.findList(new WxBusiness()); for (WxBusiness b:businessList) { resultMap.put(b.getTitle(),0l); + bussnessNameMap.put(b.getId(), b.getTitle()); } Map query = new HashedMap(); query.put("tenantId",tenantEntity.getTenantId()); if (StringUtils.isNotBlank(tenantEntity.getParentTenantId())) { query.put("parentTenantId",tenantEntity.getParentTenantId()); } - query.put("id",paramsMap.get("id")); - query.put("buildingId",paramsMap.get("buildingId")); + String floorId = paramsMap.get("id"); + String buildingId = paramsMap.get("buildingId"); + Long building = null; + if (!StringUtils.isBlank(buildingId)) { + building = Long.parseLong(buildingId); + } + Long floor = null; + if (!StringUtils.isBlank(floorId)) { + floor = Long.parseLong(floorId); + } + List merchantIds = wxMerchantService.getFloorBuildMerchantIds(tenantEntity, null, building, floor, 0, 0); + if (null != merchantIds) { + query.put("ids", merchantIds); + } List> mapList = wxMerchantMapper.findBusByFloorId(query); for (Map map:mapList) { - resultMap.put((String)map.get("btitle"),(Long)map.get("count")); + resultMap.put(bussnessNameMap.get((Integer)map.get("bid")),(Long)map.get("count")); } return new ResultData(resultMap); } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java index 5202e0a04..d7f2ce140 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponOrderServiceImpl.java @@ -280,11 +280,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { if (pageIndex == null || pageSize == null) { List list; if (isVerified) { - WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); - merchantBUserQ.updateTenantInfo(wxMerchant); - merchantBUserQ.setMerchantId(wxMerchant.getId()); - List bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); - dateMap.put("bUserIdList", bUserIds); + dateMap.put("bMerchantId", wxMerchant.getId()); list = wxCouponOrderMapper.findListOfVerifiedByDate(dateMap); }else { dateMap.put("startDateTimes", startDate.getTime()); @@ -329,13 +325,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { dateMap.put("tenantId",tenantEntity.getTenantId()); dateMap.put("startDate", startDate); dateMap.put("endDate", endDate); - - WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); - merchantBUserQ.updateTenantInfo(tenantEntity); - merchantBUserQ.setMerchantId(merchantId); - List bUserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); - dateMap.put("bUserIdList", bUserIds); - + dateMap.put("bMerchantId", merchantId); PageInfo couponOrderPage = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() ->wxCouponOrderMapper.findListOfVerifiedByDateForBUser(dateMap)); PageInfo pageInfo = new PageInfo(); pageInfo.setList(handleToCouponOrderBVoList(tenantEntity,couponOrderPage.getList(),false,false)); @@ -850,56 +840,71 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { private List handleQueryResult(List list,TenantEntity tenantEntity) { if (null != list && list.size() > 0) { - WxMerchant merchantQ = new WxMerchant(); - merchantQ.updateTenantInfo(tenantEntity); - List merchantList = wxMerchantMapper.findIdNameList(merchantQ); - Map merchantNameMap = new HashMap(); - if (null != merchantList) { - for (int i = 0 ; i < merchantList.size() ; i ++) { - WxMerchant m = merchantList.get(i); - merchantNameMap.put(m.getId(), m.getName()); - } - } - - WxCoupon couponQ = new WxCoupon(); - couponQ.updateTenantInfo(tenantEntity); - List couponList = wxCouponMapper.findTenantSimpleList(couponQ); - Map couponMap = new HashMap(); - if (null != couponList) { - for (int i = 0 ; i < couponList.size() ; i ++) { - WxCoupon c = couponList.get(i); - couponMap.put(c.getId(), c); - } - } - - List merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(tenantEntity.getTenantId(), null); - Map merchantProductIdMap = new HashMap(); - if (null != merchantProductVos) { - for (int i = 0 ; i < merchantProductVos.size(); i ++) { - WxMerchantProductVo mp = merchantProductVos.get(i); - if (mp.getMc() > 1) { - merchantProductIdMap.put(mp.getProductId(), -999L); - }else { - merchantProductIdMap.put(mp.getProductId(), mp.getMerchantId()); - } - } - } - - //循环list,获取 cUserId + //循环list,获取 cUserId List cUserIdList = new ArrayList(); - List bUserIdList = new ArrayList(); + List merchantIdList = new ArrayList(); + List couponIdList = new ArrayList(); for (int i = 0 ; i < list.size() ; i ++ ) { WxCouponOrder bo = list.get(i); Long cusrid = bo.getcUserId(); if (null != cusrid && (!cUserIdList.contains(cusrid))) { cUserIdList.add(cusrid); } - Long busrid = bo.getBUserId(); - if (null != busrid && (!bUserIdList.contains(busrid))) { - bUserIdList.add(busrid); + Long bmerchantId = bo.getBMerchantId(); + if (null != bmerchantId && (!merchantIdList.contains(bmerchantId))) { + merchantIdList.add(bmerchantId); + } + Long couponId = bo.getCouponId(); + if (null != couponId && (!couponIdList.contains(couponId))) { + couponIdList.add(couponId); } } + + Map merchantNameMap = new HashMap(); + if (null != merchantIdList && merchantIdList.size() > 0 ) { + WxMerchant merchantQ = new WxMerchant(); + merchantQ.updateTenantInfo(tenantEntity); + merchantQ.setIds(merchantIdList);; + List merchantList = wxMerchantMapper.findIdNameList(merchantQ); + if (null != merchantList) { + for (int i = 0 ; i < merchantList.size() ; i ++) { + WxMerchant m = merchantList.get(i); + merchantNameMap.put(m.getId(), m.getName()); + } + } + } + + Map couponMap = new HashMap(); + if (null != couponIdList && couponIdList.size() > 0 ) { + WxCoupon couponQ = new WxCoupon(); + couponQ.updateTenantInfo(tenantEntity); + couponQ.setIds(couponIdList); + List couponList = wxCouponMapper.findTenantSimpleList(couponQ); + if (null != couponList) { + for (int i = 0 ; i < couponList.size() ; i ++) { + WxCoupon c = couponList.get(i); + couponMap.put(c.getId(), c); + } + } + } + + Map merchantProductIdMap = new HashMap(); + if (null != merchantIdList && merchantIdList.size() > 0 ) { + List merchantProductVos = wxCouponMerchantMapper.findMerchantProduct(tenantEntity.getTenantId(), merchantIdList); + if (null != merchantProductVos) { + for (int i = 0 ; i < merchantProductVos.size(); i ++) { + WxMerchantProductVo mp = merchantProductVos.get(i); + if (mp.getMc() > 1) { + merchantProductIdMap.put(mp.getProductId(), -999L); + }else { + merchantProductIdMap.put(mp.getProductId(), mp.getMerchantId()); + } + } + } + } + + Map cUserMap = new HashMap(); if (cUserIdList.size() > 0) { WxCUserBasicInfo cUserBasicInfoQ = new WxCUserBasicInfo(); @@ -914,20 +919,6 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { } } - Map buserMerchantIdMap = new HashMap(); - if (bUserIdList.size() > 0 ) { - WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); - merchantBUserQ.setIds(bUserIdList); - merchantBUserQ.updateTenantInfo(tenantEntity); - List busrlist = wxMerchantBUserMapper.findMerchantIdListByIds(merchantBUserQ); - if (null != busrlist ) { - for (int i = 0 ; i < busrlist.size() ; i ++) { - WxMerchantBUser buser = busrlist.get(i); - buserMerchantIdMap.put(buser.getId(), buser.getMerchantId()); - } - } - } - List retList = new ArrayList(); for (int i = 0 ; i < list.size() ; i ++) { @@ -975,9 +966,9 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { co.setUserNickName(basicInfo.getNickName()); } - Long buserMechantId = buserMerchantIdMap.get(co.getBUserId()); - if (null != buserMechantId) { - co.setVerifyMerchantName(merchantNameMap.get(buserMechantId)); + Long bMechantId = co.getBMerchantId(); + if (null != bMechantId) { + co.setVerifyMerchantName(merchantNameMap.get(bMechantId)); } //co.setChannelType();) @@ -1145,16 +1136,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { wxCouponOrder.setId(-999L); return; } - - WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); - merchantBUserQ.setMerchantIds(merchantIds); - List bUserIdList = wxMerchantBUserMapper.findIdList(merchantBUserQ); - if (null == bUserIdList || bUserIdList.size() <= 0 ){ - //throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(),"核销商户下查询不到员工信息."); - wxCouponOrder.setId(-999L); - return; - } - wxCouponOrder.setBUserIdList(bUserIdList); + wxCouponOrder.setBMerchantIdList(merchantIds); } } @@ -1303,6 +1285,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { try { couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); //1核销 couponOrder.setBUserId(bUser==null?0l:bUser.getId()); + couponOrder.setBMerchantId(bUser==null?0l:bUser.getMerchantId()); couponOrder.setVerifyType(couponVerifyType.getCode()); if(EnumCouponVerifyType.VERIFY_B.equals(couponVerifyType) && StringUtils.isNotBlank(couponOrder.getVerifyRemark())){ @@ -2585,6 +2568,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { try { couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.POS_PRE_VERIFY.getCode()); //预核销 couponOrder.setBUserId(bUser.getId()); + couponOrder.setBMerchantId(bUser.getMerchantId());; couponOrder.setVerifyType(EnumCouponVerifyType.VERIFY_B.getCode()); couponOrder.setVerifyRemark(EnumCouponVerifyType.VERIFY_B_10.getMessage()); couponOrder.setUpdateDate(new Date()); @@ -2620,6 +2604,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { try { couponOrder.setCouponOrderStatus(EnumCouponOrderStatus.POS_PRE_VERIFY.getCode()); //预核销 couponOrder.setBUserId(bUser.getId()); + couponOrder.setBMerchantId(bUser.getMerchantId()); couponOrder.setVerifyType(EnumCouponVerifyType.VERIFY_B.getCode()); couponOrder.setVerifyRemark(EnumCouponVerifyType.VERIFY_B_10.getMessage()); couponOrder.setUpdateDate(new Date()); @@ -2698,6 +2683,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { WxCouponOrder updateCouponOrder = new WxCouponOrder(); updateCouponOrder.setId(couponOrderId); updateCouponOrder.setBUserId(bUser.getId()); + updateCouponOrder.setBMerchantId(bUser.getMerchantId()); updateCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USED.getCode()); updateCouponOrder.setUpdateDate(new Date()); updateCouponOrder.setPayVendor(payWay.getCode()); @@ -2758,13 +2744,7 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { private Integer findWriteOffCount(WxCouponOrder wxCouponOrder) { if (null != wxCouponOrder.getMerchantId()) { - WxMerchantBUser merchantBUserQ = new WxMerchantBUser(); - merchantBUserQ.updateTenantInfo(wxCouponOrder); - merchantBUserQ.setMerchantId(wxCouponOrder.getMerchantId()); - List buserIds = wxMerchantBUserMapper.findIdList(merchantBUserQ); - if (null != buserIds && buserIds.size() > 0) { - wxCouponOrder.setBUserIdList(buserIds); - } + wxCouponOrder.setBMerchantId(wxCouponOrder.getMerchantId()); } return wxCouponOrderMapper.findWriteOffCount(wxCouponOrder); } @@ -3027,5 +3007,121 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { } return cvo; } - + + @Override + public PageInfo userTradeDetailList(WxMerchant wxMerchant,Date startTime,Date endTime,Integer pageIndex,Integer pageSize) { + WxCouponOrder wxCouponOrderQ = new WxCouponOrder(); + wxCouponOrderQ.updateTenantInfo(wxMerchant); + wxCouponOrderQ.setStartTime(startTime); + wxCouponOrderQ.setEndTime(endTime); + WxMerchantBUser buserQ = new WxMerchantBUser(); + buserQ.updateTenantInfo(wxMerchant); + buserQ.setMerchantId(wxMerchant.getId()); + buserQ.setStatus(0); + List buserIdList = wxMerchantBUserMapper.findIdList(buserQ); + if ( null == buserIdList || buserIdList.size() <= 0 ) { + return null; + } + wxCouponOrderQ.setBUserIdList(buserIdList); + PageInfo pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxCouponOrderMapper.findUserTradeList(wxCouponOrderQ)); + PageInfo retPageInfo = new PageInfo(); + retPageInfo.setPageNum(pageInfo.getPageNum()); + retPageInfo.setPageSize(pageInfo.getPageSize()); + retPageInfo.setPages(pageInfo.getPages()); + retPageInfo.setTotal(pageInfo.getTotal()); + retPageInfo.setList(couponOrderListToTradeDetailVoList(wxMerchant,pageInfo.getList())); + return retPageInfo; + } + + private List couponOrderListToTradeDetailVoList(TenantEntity tenantEntity,List couponOrderList) { + if (null == couponOrderList || couponOrderList.size() <=0 ) { + return null; + } + List couponIdList = new ArrayList(); + List cUserIdList = new ArrayList(); + for (int i = 0 ; i < couponOrderList.size() ; i++ ) { + WxCouponOrder co = couponOrderList.get(i); + if (null != co) { + if (null != co.getCouponId() && (!couponIdList.contains(co.getCouponId()))) { + couponIdList.add(co.getCouponId()); + } + if (null != co.getCUserId() && (!cUserIdList.contains(co.getCUserId()))) { + cUserIdList.add(co.getCUserId()); + } + } + } + Map couponMap = new HashMap(); + if (couponIdList.size() > 0 ) { + WxCoupon couponQ = new WxCoupon(); + couponQ.updateTenantInfo(tenantEntity); + couponQ.setIds(couponIdList); + List couponList = wxCouponMapper.findTenantSimpleList(couponQ); + if (null != couponList) { + for (int i = 0 ; i < couponList.size(); i ++) { + WxCoupon c = couponList.get(i); + if (null != c) { + couponMap.put(c.getId(), c); + } + } + } + } + Map cUserMap = new HashMap(); + if (cUserIdList.size() > 0 ) { + WxCUserBasicInfo cuserQ = new WxCUserBasicInfo(); + cuserQ.setFinalTenantId(tenantEntity.getFinalTenantId()); + cuserQ.setIds(couponIdList); + List cuserList = wxCUserBasicInfoMapper.findListPhoneAndNameByIds(cuserQ); + if (null != cuserList) { + for (int i = 0 ; i < cuserList.size(); i ++) { + WxCUserBasicInfo u = cuserList.get(i); + if (null != u) { + cUserMap.put(u.getId(), u); + } + } + } + } + + List volist = new ArrayList(); + for (int i = 0 ; i < couponOrderList.size() ; i++ ) { + WxCouponOrder co = couponOrderList.get(i); + if (null != co) { + WxMerchantTradeDetailVo vo = toMerchantTradeDetailVo(co,couponMap,cUserMap); + if (null != vo ) { + volist.add(vo); + } + } + } + if (volist.size() <=0 ) { + return null; + } + return volist; + } + private WxMerchantTradeDetailVo toMerchantTradeDetailVo(WxCouponOrder co,Map couponMap,Map cUserMap) { + if (null == co) { + return null; + } + WxMerchantTradeDetailVo vo = new WxMerchantTradeDetailVo(); + vo.setTradeDate(co.getCreateDate()); + if (null != co.getCUserId()) { + WxCUserBasicInfo user = cUserMap.get(co.getCUserId()); + if (null != user) { + String name = user.getName(); + if (StringUtils.isBlank(name)) { + name = user.getNickName(); + } + vo.setUserName(name); + vo.setPhone(user.getPhone()); + } + } + if (null != co.getCouponId()) { + WxCoupon coupon = couponMap.get(co.getCouponId()); + if (null != coupon) { + vo.setCouponName(coupon.getTitle()); + vo.setCouponSale(coupon.getSalePrice()); + vo.setCouponPrice(coupon.getPrice()); + vo.setTradeAmt(coupon.getPrice()); + } + } + return vo; + } } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java index 3c28739ad..34d349bb7 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxCouponServiceImpl.java @@ -32,6 +32,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.context.annotation.Lazy; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; @@ -59,15 +60,19 @@ public class WxCouponServiceImpl implements WxCouponService { @Autowired WxMerchantMapper wxMerchantMapper; + @Lazy @Autowired WxCouponChannelService wxCouponChannelService; + @Lazy @Autowired WxCouponSendService wxCouponSendService; + @Lazy @Autowired WxOrderService wxOrderService; + @Lazy @Autowired WxScreenAdService wxScreenAdService; @@ -107,6 +112,9 @@ public class WxCouponServiceImpl implements WxCouponService { @Autowired @Qualifier("couponChannelRedisTemplate") RedisTemplate> cdRedisTemplate; + + @Autowired + WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; @Override public ResultData list(TenantEntity tenantEntity,WxCoupon wxCoupon, Integer pageNum, Integer pageSize) { @@ -391,10 +399,20 @@ public class WxCouponServiceImpl implements WxCouponService { Long id = jsonObject.getLong("id"); WxMerchant wxMerchant = new WxMerchant(); wxMerchant.setId(id); - WxMerchant merchant = wxMerchantMapper.queryMerchantByMerchantIdOfSharingReceiver(wxMerchant); - if (merchant.getId() == null) { - flag = true; - sb.append("[").append(merchant.getName()).append("]"); + WxMerchant merchant = wxMerchantMapper.selectById(id); + if (null == merchant) { + flag = true; + sb.append("[未查询到商户信息]"); + }else { + WxProfitSharingReceiver wxProfitSharingReceiverQ = new WxProfitSharingReceiver(); + wxProfitSharingReceiverQ.updateTenantInfo(record); + wxProfitSharingReceiverQ.setStatus(0); + wxProfitSharingReceiverQ.setMerchantId(id); + WxProfitSharingReceiver receiver = wxProfitSharingReceiverMapper.findOne(wxProfitSharingReceiverQ); + if (null == receiver || receiver.getId() == null) { + flag = true; + sb.append("[").append(merchant.getName()).append("]"); + } } } if (flag) { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java index 4d95037a1..af1d08522 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantServiceImpl.java @@ -26,6 +26,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; @@ -68,9 +69,11 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Autowired WxCouponMapper wxCouponMapper; + @Lazy @Autowired WxCouponService wxCouponService; + @Lazy @Autowired WxProfitSharingReceiverService wxProfitSharingReceiverService; @@ -86,9 +89,11 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Autowired WxCouponMerchantMapper wxCouponMerchantMapper; + @Lazy @Autowired WxRentContractService wxRentContractService; + @Lazy @Autowired WxLevelConfigService wxLevelConfigService; @@ -101,12 +106,15 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Autowired WxProfitSharingReceiverMapper wxProfitSharingReceiverMapper; + @Lazy @Autowired WxPropertyContractService wxPropertyContractService; + @Lazy @Autowired WxMallService wxMallService; + @Lazy @Autowired WxShopService wxShopService; @@ -116,8 +124,22 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Autowired TtUserFollowMapper ttUserFollowMapper; + @Lazy @Autowired private QrCodeService qrCodeService; + + @Autowired + WxBusinessMapper wxBusinessMapper; + + @Autowired + WxCouponOrderMapper wxCouponOrderMapper; + + @Lazy + @Autowired + WxCouponOrderService wxCouponOrderService; + + @Autowired + WxBrandMapper wxBrandMapper; @Override public PageInfo listAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { @@ -128,17 +150,95 @@ public class WxMerchantServiceImpl implements WxMerchantService { public List queryIdAndNames (WxMerchant record) { return wxMerchantMapper.findIdNameList(record); } - - @Override - public PageInfo listAsPageCVo(WxMerchantDto record, Integer pageIndex, Integer pageSize) { - return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findListCVo(record)); + public WxMerchantVo getMerchantInfo(HashMap params) { + WxMerchant merchant = wxMerchantMapper.getMerchantByCode(params); + if (null == merchant) { + return null; + } + WxBusiness bussiness = null; + if (null != merchant.getBusinessId()) { + bussiness = wxBusinessMapper.selectById(merchant.getBusinessId()); + } + List shopVoList = wxShopService.findMerchantShopVoList(merchant,merchant.getId()); + return merchantToVo(merchant,bussiness,shopVoList); } - + @Override - public WxMerchantVo getMerchantInfo(HashMap params) { - return wxMerchantMapper.getMerchantByCode(params); + public PageInfo listAsPageCVo(WxMerchantDto wxMerchantDto, Integer pageIndex, Integer pageSize,boolean hasShop) { + if (null != wxMerchantDto.getBuilding() || null != wxMerchantDto.getFloor()) { + List merchantIds = getFloorBuildMerchantIds(wxMerchantDto, null, wxMerchantDto.getBuilding(), wxMerchantDto.getFloor(), null, null); + wxMerchantDto.setIds(merchantIds); + } + PageInfo pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findListCVo(wxMerchantDto)); + PageInfo retPageInfo = new PageInfo(); + retPageInfo.setPageNum(pageInfo.getPageNum()); + retPageInfo.setPageSize(pageInfo.getPageSize()); + retPageInfo.setPages(pageInfo.getPages()); + retPageInfo.setTotal(pageInfo.getTotal()); + retPageInfo.setList(toVoList(wxMerchantDto,pageInfo.getList(),hasShop)); + return retPageInfo; + } + + private List toVoList(TenantEntity tenantEntity,List merchantList,boolean hasShop) { + if (null == merchantList || merchantList.size() <= 0 ) { + return null; + } + List bussinessList = wxBusinessMapper.findListAll(); + Map bussinessMap = new HashMap(); + if (null != bussinessList) { + for (int i = 0 ; i < bussinessList.size() ; i ++) { + WxBusiness bu = bussinessList.get(i); + bussinessMap.put(bu.getId() ,bu); + } + } + Map> merchantShopMap = null; + if (hasShop) { + List merchantIds = new ArrayList(); + for (int i = 0 ; i < merchantList.size() ; i ++) { + WxMerchant m = merchantList.get(i); + if (!merchantIds.contains(m.getId())) { + merchantIds.add(m.getId()); + } + } + if (merchantIds.size() > 0 ) { + merchantShopMap = wxShopService.findMerchantShopVoListMap(tenantEntity, merchantIds); + } + } + + List retList = new ArrayList(); + for (int i = 0 ; i < merchantList.size() ; i ++) { + WxMerchant m = merchantList.get(i); + WxBusiness bussiness = null; + if (null != m.getBusinessId()) { + bussiness = bussinessMap.get(m.getBusinessId()); + } + List shopVoList = null; + if (hasShop && null != merchantShopMap) { + shopVoList = merchantShopMap.get(m.getId()); + } + WxMerchantVo vo = merchantToVo(m, bussiness, shopVoList); + if (null != vo ) { + retList.add(vo); + } + } + return retList; + } + + private WxMerchantVo merchantToVo(WxMerchant m ,WxBusiness bussiness,List shopVoList) { + if (null == m) { + return null; + } + WxMerchantVo vo = new WxMerchantVo(); + vo.initByMerchant(m); + if (null != bussiness) { + vo.setBusinessName(bussiness.getTitle()); + } + if (null != shopVoList && shopVoList.size() > 0 ) { + vo.setShopVoList(shopVoList); + } + return vo; } @Override @@ -739,10 +839,15 @@ public class WxMerchantServiceImpl implements WxMerchantService { } @Override - public WxMerchantVo findMerchantById(Long id) { + public WxMerchantVo findMerchantById(TenantEntity tenantEntity,Long id) { WxMerchantDto merchant = new WxMerchantDto(); merchant.setId(id); - List listCVo = wxMerchantMapper.findListCVo(merchant); + merchant.updateTenantInfo(merchant); + PageInfo page = listAsPageCVo(merchant,1,1,true); + if (null == page) { + return null; + } + List listCVo = page.getList(); return listCVo.isEmpty() ? new WxMerchantVo() : listCVo.get(0); } @@ -772,7 +877,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { } //商铺信息 - m.setShopVos(wxShopMapper.findShopVoList(m.getId())); + m.setShopVos(wxShopService.findMerchantShopVoList(m,m.getId())); //店员信息 WxMerchantBUser wxMerchantBUser = new WxMerchantBUser(); @@ -857,50 +962,229 @@ public class WxMerchantServiceImpl implements WxMerchantService { return Optional.empty(); } + private void initQueryParam(WxMerchant record,boolean hasRentContractInfo,Map merchantRentMap) { + if (hasRentContractInfo) { + WxRentContract wxRentContractQ = new WxRentContract(); + wxRentContractQ.updateTenantInfo(record); + List statusList = new ArrayList(); + statusList.add(2); + statusList.add(3); + statusList.add(4); + wxRentContractQ.setStatuss(statusList); + List rentList = wxRentContractMapper.findList(wxRentContractQ); + if (null != rentList) { + for (int i = 0 ; i < rentList.size(); i++) { + WxRentContract contract = rentList.get(i); + if (null != contract && null != contract.getMerchantId()) { + merchantRentMap.put(contract.getMerchantId(), contract); + } + } + } + } + List merchantIds = new ArrayList(); + String phone = StringUtils.trimToNull(record.getPhone()); + if (null != phone) { + WxMerchantBUser buserQ = new WxMerchantBUser(); + buserQ.setPhoneLike(phone); + buserQ.setStatus(0); + List userMerchantIds = wxMerchantBUserMapper.findMerchantIdList(buserQ); + if (null == userMerchantIds || userMerchantIds.size() <=0 ) { + record.setId(-999L); + return; + }else { + merchantIds.addAll(userMerchantIds); + } + } + + String floorRule = StringUtils.trimToNull(record.getFloorForRule()); + Long building = record.getBuilding(); + Long floor = record.getFloor(); + List floorMerchantIds = getFloorBuildMerchantIds(record, floorRule, building, floor, 0, 0); + if (null != floorMerchantIds) { + merchantIds.retainAll(floorMerchantIds); + } + if (merchantIds.size() > 0 ) { + record.setIds(merchantIds); + } + + Integer rentShopType = record.getRentShopType(); + if (null != rentShopType) { + WxRentContract rentContractQ = new WxRentContract(); + rentContractQ.updateTenantInfo(record); + rentContractQ.setStatuss(EnumRentContractStatus.getValidStatus()); + List usedMerchantIds = wxRentContractMapper.getMerchantIdsByStatuss(rentContractQ); + if (null != usedMerchantIds && usedMerchantIds.size() >0 ) { + record.setNotInids(usedMerchantIds); + } + } + } + @Override - public PageInfo listVoAsPage(WxMerchant record, Integer pageIndex, Integer pageSize) { - PageHelper.startPage(pageIndex, pageSize); - List merchants = wxMerchantMapper.findListVo(record); - for (WxMerchant merchant : merchants) { - if (record.getRentShopType() != null) { - List> shops = new ArrayList<>(); - WxMerchantShop wxMerchantShop = new WxMerchantShop(); - wxMerchantShop.setMerchantId(merchant.getId()); - wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); - List wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShop); - for (WxMerchantShop merchantShop : wxMerchantShopList) { - WxShop shop = new WxShop(); - shop.setId(merchantShop.getShopId()); - List> shoplist = wxShopMapper.findListMap(shop); - if (shoplist.size() > 0) { - shops.add(shoplist.get(0)); + public List getFloorBuildMerchantIds(TenantEntity tenantEntity,String floorRule,Long building,Long floor,Integer merchantShopDel,Integer shopDel ) { + if (null != floorRule || null != building || null != floor) { + List floorMerchantIds = null; + WxShop shopQ = new WxShop(); + if (null != shopDel) { + shopQ.setIsDel(shopDel); + } + shopQ.updateTenantInfo(tenantEntity); + if (null != floorRule) { + shopQ.setFloorForRule(floorRule); + } + if (null != building) { + shopQ.setBuilding(building); + } + if (null != floor) { + shopQ.setFloor(floor); + } + List shopIds = wxShopMapper.findIdList(shopQ); + if (null == shopIds || shopIds.size() <= 0) { + floorMerchantIds = new ArrayList(); + floorMerchantIds.add(-999L); + return floorMerchantIds; + } + WxMerchantShop merchantShopQ = new WxMerchantShop(); + if (null != merchantShopDel) { + merchantShopQ.setIsDel(merchantShopDel); + } + merchantShopQ.updateTenantInfo(tenantEntity); + merchantShopQ.setShopIdList(shopIds); + floorMerchantIds = wxMerchantShopMapper.findMerchantIdList(merchantShopQ); + if (null == floorMerchantIds || floorMerchantIds.size() <= 0) { + floorMerchantIds = new ArrayList(); + floorMerchantIds.add(-999L); + return floorMerchantIds; + } + } + return null; + } + + @Override + public PageInfo listVoAsPage(WxMerchant record, Integer pageIndex, Integer pageSize,boolean hasRentContractInfo) { + Map merchantRentMap = new HashMap(); + initQueryParam(record,hasRentContractInfo, merchantRentMap); + PageInfo pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.findList(record)); + if (null != pageInfo && null != pageInfo.getList()) { + for (WxMerchant merchant : pageInfo.getList()) { + if (hasRentContractInfo) { + WxRentContract contract = merchantRentMap.get(merchant.getId()); + if (null != contract) { + merchant.setRentalStartDate(contract.getRentalStartDate()); + merchant.setRentalEndDate(contract.getRentalEndDate()); + } + } + if (record.getRentShopType() != null) { + List> shops = new ArrayList<>(); + WxMerchantShop wxMerchantShop = new WxMerchantShop(); + wxMerchantShop.setMerchantId(merchant.getId()); + wxMerchantShop.setIsDel(EnumDelStatus.NOT_DEL.getCode()); + List wxMerchantShopList = wxMerchantShopMapper.findList(wxMerchantShop); + for (WxMerchantShop merchantShop : wxMerchantShopList) { + WxShop shop = new WxShop(); + shop.setId(merchantShop.getShopId()); + List> shoplist = wxShopMapper.findListMap(shop); + if (shoplist.size() > 0) { + shops.add(shoplist.get(0)); + } } + merchant.setShoplist(shops); } - merchant.setShoplist(shops); - } - WxRentContract rc = new WxRentContract(); - rc.setMerchantId(merchant.getId()); - rc.setTenantId(merchant.getTenantId()); - List rentContractList = wxRentContractMapper.findList(rc); - if(CollectionUtils.isEmpty(rentContractList)){ - merchant.setHasContract(EnumHasContract.NO.getCode()); - }else{ - merchant.setHasContract(EnumHasContract.HAS.getCode()); + WxRentContract rc = new WxRentContract(); + rc.setMerchantId(merchant.getId()); + rc.setTenantId(merchant.getTenantId()); + List rentContractList = wxRentContractMapper.findList(rc); + if(CollectionUtils.isEmpty(rentContractList)){ + merchant.setHasContract(EnumHasContract.NO.getCode()); + }else{ + merchant.setHasContract(EnumHasContract.HAS.getCode()); + } } - } - PageInfo pageInfo = new PageInfo<>(merchants); - return pageInfo; + } + return pageInfo; } @Override public PageInfo userTradeList(WxMerchant record, Integer pageIndex, Integer pageSize) { - return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.userTradeList(record)); + PageInfo pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.userTradeMerchantList(record)); + PageInfo retPageInfo = new PageInfo(); + retPageInfo.setPageNum(pageInfo.getPageNum()); + retPageInfo.setPageSize(pageInfo.getPageSize()); + retPageInfo.setPages(pageInfo.getPages()); + retPageInfo.setTotal(pageInfo.getTotal()); + retPageInfo.setList(toMerchantTradeVoList(record,pageInfo.getList(),record.getStarttime(),record.getEndtime())); + return retPageInfo; } + + private List toMerchantTradeVoList(TenantEntity tenantEntity,List merchantList,Date startTime,Date endTime) { + if (null == merchantList || merchantList.size() <=0 ) { + return null; + } + List merchantIds = new ArrayList(); + for (int i = 0 ; i < merchantList.size();i++) { + WxMerchant m = merchantList.get(i); + if (null != m) { + if (!merchantIds.contains(m.getId())) { + merchantIds.add(m.getId()); + } + } + } + Map merchantTradeMap = new HashMap(); + if (merchantIds.size() > 0 ) { + Map param = new HashMap(); + param.put("tenantId", tenantEntity.getTenantId()); + param.put("parentTenantId", tenantEntity.getParentTenantId()); + param.put("starttime", startTime); + param.put("endtime", endTime); + param.put("bMerchantIdList", merchantIds); + List tradeList = wxCouponOrderMapper.findMerchantUserTradeList(param); + if (null != tradeList && tradeList.size() > 0 ) { + for (int i = 0 ; i < tradeList.size(); i ++) { + Map map = tradeList.get(i); + if (null != map) { + merchantTradeMap.put((Long)map.get("bMerchantId"), map); + } + } + } + + } + List retList = new ArrayList<>(); + for (int i = 0 ; i < merchantList.size();i++) { + WxMerchant m = merchantList.get(i); + if (null != m) { + WxMerchantTradeVo vo = new WxMerchantTradeVo(); + vo.setId(m.getId()); + vo.setCover(m.getImgUrl()); + vo.setMerchantName(m.getName()); + vo.setLinkName(m.getLinkPerson()); + Map tradeMap = merchantTradeMap.get(m.getId()); + if (null != tradeMap) { + Integer consumeCount = (Integer)tradeMap.get("consumeCount"); + vo.setConsumeCount(consumeCount==null?0:consumeCount); + Integer consumeCountP = (Integer)tradeMap.get("consumeCountP"); + vo.setConsumeCountP(consumeCountP==null?0:consumeCountP); + Integer tradeAmt = (Integer)tradeMap.get("tradeAmt"); + vo.setTradeAmt(tradeAmt==null?0:tradeAmt); + } + retList.add(vo);; + } + } + if(retList.size() <= 0) { + return null; + } + return retList; + } + @Override public void exportUserTradeList(WxMerchant record,HttpServletRequest request, HttpServletResponse response) { - List datalist = wxMerchantMapper.userTradeDetailList(record); + PageInfo pageInfo = wxCouponOrderService.userTradeDetailList(record,record.getStarttime(),record.getEndtime(),1,10000); + List datalist = null; + if (null == pageInfo || null == pageInfo.getList()) { + datalist = new ArrayList(); + }else { + datalist = pageInfo.getList(); + } datalist.stream().forEach(e->{ if(e.getTradeDate() != null) { e.setTradeDateStr(DateUtils.formatDateTime(e.getTradeDate())); @@ -918,7 +1202,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Override public PageInfo userTradeDetailList(WxMerchant record, Integer pageIndex, Integer pageSize) { - return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantMapper.userTradeDetailList(record)); + return wxCouponOrderService.userTradeDetailList(record,record.getStarttime(),record.getEndtime(),pageIndex,pageSize); } @Override @@ -953,7 +1237,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { Map> merchantShopVoList = null; if (hasShop) { - merchantShopVoList = wxShopService.findMerchantShopVoList(tenantEntity,merchantIds); + merchantShopVoList = wxShopService.findMerchantShopVoListMap(tenantEntity,merchantIds); } Map> retMap = new HashMap>(); @@ -997,7 +1281,7 @@ public class WxMerchantServiceImpl implements WxMerchantService { vo.setSubBusinessId(m.getSubBusinessId()); vo.setParameter(cm.getParameter()); vo.setLinkLinePhone(m.getLinkLinePhone()); - if (hasShop) { + if (hasShop && null != merchantShopVoList) { vo.setShopVoList(merchantShopVoList.get(vo.getId())); } return vo; @@ -1014,14 +1298,6 @@ public class WxMerchantServiceImpl implements WxMerchantService { return null; } - @Override - public PageInfo listVoAsPage2(WxMerchant record, Integer pageIndex, Integer pageSize) { - PageHelper.startPage(pageIndex, pageSize); - List merchants = wxMerchantMapper.findListVo2(record); - PageInfo pageInfo = new PageInfo<>(merchants); - return pageInfo; - } - @Override public List getMerchantList(WxMerchant wxMerchant) { return wxMerchantMapper.getMerchantList(wxMerchant); @@ -1229,22 +1505,62 @@ public class WxMerchantServiceImpl implements WxMerchantService { @Override public Map findMerchantByShop(Long shopId) { - List> merchantByShop = wxMerchantMapper.findMerchantByShop(shopId); - if(merchantByShop != null && merchantByShop.size() > 0){ - return merchantByShop.get(0); - } - return null; + return getShopMerchantMap(shopId,1); } + private Map getShopMerchantMap(Long shopId,int type) { + WxShop shop = wxShopMapper.selectById(shopId); + if (null == shop) { + return null; + } + WxMerchantShop merchantShopQ = new WxMerchantShop(); + merchantShopQ.setShopId(shopId); + merchantShopQ.setIsDel(0); + List merchantShopList = wxMerchantShopMapper.findList(merchantShopQ); + if (null == merchantShopList || merchantShopList.size() <= 0 ) { + return null; + } + WxMerchantShop ms = merchantShopList.get(0); + Long merchantId = ms.getMerchantId(); + Map merchantMap = null; + if (1== type) { + merchantMap = wxMerchantMapper.findShopMerchant(merchantId); + }else if (2== type) { + merchantMap = wxMerchantMapper.detailShopMerchantById(ms,merchantId); + } + if (null == merchantMap) { + return null; + } + Long brandId = (Long)merchantMap.get("brand"); + if (null != brandId) { + WxBrand brand = wxBrandMapper.selectById(brandId); + if (null != brand) { + merchantMap.put("brandName", brand.getName()); + } + } + Integer businessId = (Integer)merchantMap.get("business_id"); + if (null != businessId) { + WxBusiness business = wxBusinessMapper.selectById(brandId); + if (null != business) { + merchantMap.put("businessTitle", business.getTitle()); + } + } + WxMerchantCorp wxMerchantCorpQ = new WxMerchantCorp(); + wxMerchantCorpQ.setMerchantId(merchantId); + List clist = wxMerchantCorpMapper.findList(wxMerchantCorpQ); + if (null != clist && clist.size() >0 ) { + WxMerchantCorp mc = clist.get(0); + merchantMap.put("corpPapersRegisterNumber", mc.getCorpPapersRegisterNumber()); + merchantMap.put("corpPapersAddress", mc.getCorpPapersAddress()); + } + return merchantMap; + } + + @Override public Map detailByShopId(TenantEntity tenantInfo, Long shopId) { - List> merchants = wxMerchantMapper.detailByShopId(tenantInfo,shopId); - if(merchants != null && merchants.size() > 0){ - return merchants.get(0); - } - return null; + return getShopMerchantMap(shopId,2); } - } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantTradeDailyServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantTradeDailyServiceImpl.java index 1a6ede0cc..3fbfde9ce 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantTradeDailyServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxMerchantTradeDailyServiceImpl.java @@ -47,7 +47,7 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ ExcelService excelService; @Autowired - WxShopMapper wxShopMapper; + WxShopService wxShopService; @Override @@ -186,7 +186,7 @@ public class WxMerchantTradeDailyServiceImpl implements WxMerchantTradeDailyServ list.stream().forEach(m -> { //商铺信息 - m.setShopVos(wxShopMapper.findShopVoList(m.getMerchantId())); + m.setShopVos(wxShopService.findMerchantShopVoList(m,m.getMerchantId())); }); //商铺信息 diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java index 54e7b06ee..1471663cd 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxProfitSharingReceiverServiceImpl.java @@ -25,6 +25,7 @@ import com.iformall.mq.MqBaseProducer; import com.iformall.pay.WxPayment; import com.iformall.pay.WxProfitSharing; import com.iformall.pay.WxProfitSharingReceiverP; +import com.iformall.service.WxMerchantService; import com.iformall.service.WxProfitSharingReceiverService; import com.iformall.service.pay.PayServiceFactory; import com.iformall.service.pay.service.share.entity.ShareAccountResult; @@ -35,6 +36,7 @@ import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import java.util.Date; @@ -63,8 +65,11 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv WxAppinfoMapper wxAppinfoMapper; @Autowired WxPayAccountMapper wxPayAccountMapper; + + @Lazy @Autowired - WxMerchantMapper wxMerchantMapper; + WxMerchantService wxMerchantService; + @Autowired private MqBaseProducer mqBaseProducer; @@ -169,8 +174,14 @@ public class WxProfitSharingReceiverServiceImpl implements WxProfitSharingReceiv private void sendMsgByType(Integer type, Long merchantId, String account, TenantEntity tenantEntity) { WxMerchantDto wxMerchantDto = new WxMerchantDto(); wxMerchantDto.setId(merchantId); - List listCVo = wxMerchantMapper.findListCVo(wxMerchantDto); - if (listCVo.isEmpty()) { + wxMerchantDto.updateTenantInfo(tenantEntity); + PageInfo pageInfo = wxMerchantService.listAsPageCVo(wxMerchantDto,1,1,false); + if (null == pageInfo) { + logger.info("更新商户分账账户发短信时未找到商户:" + merchantId); + return; + } + List listCVo = pageInfo.getList(); + if (null == listCVo || listCVo.isEmpty()) { logger.info("更新商户分账账户发短信时未找到商户:" + merchantId); return; } diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java index 28d879ed1..126233c26 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxRefundOrderServiceImpl.java @@ -124,7 +124,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { @Override @Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) - public ResultData createRefundOrder(WxAppinfo appInfo, Long couponOrderId, EnumPayType payType, Long bUserId, Long aUserId) { + public ResultData createRefundOrder(WxAppinfo appInfo, Long couponOrderId, EnumPayType payType, WxMerchantBUser bUser, Long aUserId) { WxCouponOrder wxCouponOrder = wxCouponOrderMapper.selectById(couponOrderId,appInfo.getTenantId()); if (wxCouponOrder == null) { logger.error("券ID不存在:" + couponOrderId); @@ -137,15 +137,15 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { } if (payType == EnumPayType.PAY_B_REFUND) { - logger.info("B端发起退款: bUserId-" + bUserId); - if (bUserId == null || bUserId == 0) { - logger.error("B端用户不存在:" + bUserId); + logger.info("B端发起退款: bUserId-" + bUser); + if (bUser == null || bUser.getId() == 0) { + logger.error("B端用户不存在:" + bUser); throw new MallinkException(ErrorCode.USER_IS_EMPTY); } // B端用户退款检查一下商户 - WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById(bUserId); + WxMerchantBUser wxMerchantBUser = wxMerchantBUserMapper.selectById(bUser.getId()); if (wxMerchantBUser == null) { - logger.error("操作员ID不存在:" + bUserId); + logger.error("操作员ID不存在:" + bUser.getId()); throw new MallinkException(ErrorCode.REFUND_ORDER_BUSER_IS_NULL); } if (!isMerchantOrder(wxOrder, wxMerchantBUser.getMerchantId())) { @@ -222,7 +222,7 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { rOrder.setPayVendor(wxOrder.getPayVendor()); rOrder.setCUserId(wxOrder.getCUserId()); if (payType == EnumPayType.PAY_B_REFUND) { - rOrder.setDetail("["+bUserId+"]B端管理员操作退款"); //B端发起退款后存B端用户ID在此 + rOrder.setDetail("["+bUser.getId()+"]B端管理员操作退款"); //B端发起退款后存B端用户ID在此 }else if (payType == EnumPayType.PAY_ADMIN_REFUND) { rOrder.setDetail("["+aUserId+"]A端管理员操作退款"); } else if (payType == EnumPayType.PAY_AUTO_REFUND) { @@ -252,14 +252,17 @@ public class WxRefundOrderServiceImpl implements WxRefundOrderService { wxCouponOrder.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_INVALID.getCode()); //3退款,券作废 } if (payType == EnumPayType.PAY_B_REFUND) { - wxCouponOrder.setBUserId(bUserId); + wxCouponOrder.setBUserId(bUser.getId()); wxCouponOrder.setAUserId(payType.getCode().longValue()); + wxCouponOrder.setBMerchantId(bUser.getMerchantId()); } else if (payType == EnumPayType.PAY_ADMIN_REFUND) { wxCouponOrder.setBUserId(payType.getCode().longValue()); wxCouponOrder.setAUserId(aUserId); + wxCouponOrder.setBMerchantId(0L); } else { wxCouponOrder.setBUserId(payType.getCode().longValue()); wxCouponOrder.setAUserId(payType.getCode().longValue()); + wxCouponOrder.setBMerchantId(0L); } wxCouponOrder.setUpdateDate(currentDate); try { diff --git a/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java index 0fb74376a..d0d1a58c0 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/WxShopServiceImpl.java @@ -273,7 +273,7 @@ public class WxShopServiceImpl implements WxShopService { } @Override - public Map> findMerchantShopVoList(TenantEntity tenantEntity, List merchantIds) { + public Map> findMerchantShopVoListMap(TenantEntity tenantEntity, List merchantIds) { Map floorMap = wxMallFloorService.getFloorMap(tenantEntity); Map buildingMap = wxMallBuildingService.getBuildingMap(tenantEntity); List shopIds = wxMerchantShopMapper.findShopIds(merchantIds); @@ -292,9 +292,10 @@ public class WxShopServiceImpl implements WxShopService { WxMerchantShop merchantShopQ = new WxMerchantShop(); merchantShopQ.updateTenantInfo(tenantEntity); merchantShopQ.setMerchantIds(merchantIds); + merchantShopQ.setIsDel(0); List merchantShops = wxMerchantShopMapper.findList(merchantShopQ); if (null == merchantShops) { - return null; + return retMap; } for (int i = 0 ; i < merchantShops.size(); i ++) { WxMerchantShop ms = merchantShops.get(i); @@ -312,4 +313,12 @@ public class WxShopServiceImpl implements WxShopService { } return retMap; } + + @Override + public List findMerchantShopVoList(TenantEntity tenantEntity,Long merchantId) { + List merchantIds = new ArrayList(); + merchantIds.add(merchantId); + Map> map = findMerchantShopVoListMap(tenantEntity, merchantIds); + return map.get(merchantId); + } } diff --git a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml index e62176a4c..7580e14ba 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml @@ -10,6 +10,7 @@ + @@ -37,7 +38,7 @@ - `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_type`,`c_user_id`,`owner_id`,`b_user_id`,`order_id`,`expired_time`,`coupon_order_status`,`create_date`,`update_date`,`coupon_price`, `auto_refund`, + `id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_type`,`c_user_id`,`owner_id`,`b_user_id`,`b_merchant_id`,`order_id`,`expired_time`,`coupon_order_status`,`create_date`,`update_date`,`coupon_price`, `auto_refund`, `verify_type`,`verify_remark`,`pay_vendor`,`send_merchant_id`,`send_merchant_user_id`,`compose_order_type`,`compose_order_id`,`parent_coupon_order_id`,`coupon_number`, `freight_price`,`shipping_type`,`shipping_address`,`shipping_status`,`delivery_info`,`subsidy` @@ -70,6 +71,10 @@ and `b_user_id` = #{bUserId} + + + and `b_merchant_id` = #{bMerchantId} + and `a_user_id` = #{aUserId} @@ -154,17 +159,14 @@ select - co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id, + co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id, co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark, co.pay_vendor, co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info` FROM wx_coupon_order co @@ -843,7 +855,7 @@ select - co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor, + co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.verify_type,co.verify_remark,co.pay_vendor, co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info` from wx_coupon_order co where co.id = #{id} and co.tenant_id = #{tenantId} @@ -934,7 +943,7 @@ select - co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status, + co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.order_id,co.expired_time,co.coupon_order_status, co.create_date,co.update_date,co.coupon_price from wx_coupon_order co where co.id = #{id} and co.tenant_id = #{tenantId} @@ -1057,12 +1066,65 @@ AND co.update_date <= #{endTime} - + + AND co.b_merchant_id = #{bMerchantId} + + + + + + + + \ No newline at end of file diff --git a/mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml b/mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml index 69fb3ddf3..8f82b9f37 100644 --- a/mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxMerchantBUserMapper.xml @@ -38,6 +38,10 @@ and `phone` = #{phone} + + + and `phone` like concat('%', #{phoneLike},'%') + and `user_pwd` like concat('%', #{userPwd},'%') @@ -108,6 +112,12 @@ + + - - - - - - - and m.id in( - select ms.merchant_id from (select merchant_id,shop_id from wx_merchant_shop where is_del=0) ms - inner join wx_merchant m on ms.merchant_id = m.id - inner join wx_shop s on s.id=ms.shop_id - where s.is_del=0 - - and m.`tenant_id` = #{tenantId} - - - and m.`parent_tenant_id` = #{parentTenantId} - - - and m.business_id in (${businessForRule}) - - - and s.`floor` in (${floorForRule}) - - ) - - - - - where m.is_del = 0 - - - and m.`id` = #{id} - - + - select - - FROM wx_merchant m - left join wx_business bu on bu.id = m.business_id - - - and m.`tenant_id` = #{tenantId} - - - and m.`parent_tenant_id` = #{parentTenantId} - - - and m.`status` = #{status} - - - and md5(m.`id`) = #{merchantCode} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - select - - FROM wx_merchant m - - join wx_merchant_shop ms on ms.merchant_id=m.id - join wx_shop s on ms.shop_id=s.id - - and s.building = #{building} - - - and s.floor = #{floor} - - - left join wx_business bu on bu.id = m.business_id - where 1=1 and m.is_del=0 + + FROM wx_merchant m where m.is_del=0 and m.`tenant_id` = #{tenantId} @@ -510,57 +246,49 @@ and m.`id` = #{id} + + + and m.id in + + #{idItem} + + order by m.top_time desc - - - - SELECT m.id, m.`img_url` cover, m.`name` merchantName,m.`encode` merchantEncode, m.`link_person` linkName, - ifnull(consume.consumeCount,0) consumeCount,ifnull(consume.consumeCountP,0) as consumeCountP, - ifnull(consume.tradeAmt,0) tradeAmt + - - + - select m.`id`,m.`tenant_id` tenantId,m.`parent_tenant_id` parentTenantId,m.`img_url`,m.`name`,m.`encode`,m.`link_phone`,m.`create_date`,m.`update_date`, m.`car_vendor_type`,m.`car_params`,m.`status`,m.`link_person`, m.`business_id`,m.`business_types`,m.`sub_business_id`,m.`shop_type`,m.`brand`,m.`type`,m.`is_public`,m.email,m.`title`,m.`cover_picture`,m.`is_admin`,m.`bill_setting`,m.`qr_code`,m.`tt_qr_code`, - m.`introduction`,m.`action_desc`,m.`mark`,m.mark_time,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,m.credit_locked,m.credit_locked, - b.name brandName,bu.title businessTitle,mc.corp_papers_register_number corpPapersRegisterNumber,mc.corp_papers_address corpPapersAddress - from wx_merchant m - left join wx_merchant_shop ms on ms.merchant_id = m.id and ms.is_del = 0 - left join wx_shop s on s.id = ms.shop_id - left join wx_brand b on m.brand = b.id - left join wx_business bu on m.business_id = bu.id - left join wx_merchant_corp mc on mc.merchant_id = m.id - where m.is_del = 0 + m.`introduction`,m.`action_desc`,m.`mark`,m.mark_time,m.`is_del`,m.`talk_user_main`,m.`talk_user_aux`,m.link_line_phone,m.credit_locked,m.credit_locked + from wx_merchant m where m.id = #{id} and m.is_del = 0 and m.`tenant_id` = #{tenantInfo.tenantId} and m.`parent_tenant_id` = #{tenantInfo.parentTenantId} - and s.`id` = #{shopId} diff --git a/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml b/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml index 2b4ea015b..7b523fa09 100644 --- a/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxProfitSharingReceiverMapper.xml @@ -109,7 +109,13 @@ - + diff --git a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml index 6dbd5d23c..0332d54ca 100644 --- a/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxRentContractMapper.xml @@ -222,85 +222,6 @@ - - - - - - - - - - - - - - - - - - - update wx_rent_contract set apply_status=#{applyStatus} @@ -416,48 +246,6 @@ update wx_rent_contract set status=#{status} where id=#{id} - - - - - - - - - - - @@ -712,56 +460,12 @@ where m.business_id = #{id} and c.price is not null and c.`rental_start_date` is not null and c.`rental_end_date` is not null - - - - - - - - - - - - - - - - - - - - - select id,shop_number shopNumber,img_url imgUrl,addr,building,floor + select id,shop_number shopNumber,img_url imgUrl,addr,building,floor,baidu_poi baiduPoi,manager_phone linkPhone,manager linkPerson from wx_shop where is_del=0 diff --git a/mallinkTTAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java b/mallinkTTAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java index e04296d7c..f9871e2a1 100644 --- a/mallinkTTAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java +++ b/mallinkTTAdmin/src/main/java/com/iformall/controller/basic/WxMerchantController.java @@ -59,7 +59,7 @@ public class WxMerchantController extends BaseController { if (null == wxMerchant) wxMerchant = new WxMerchant(); wxMerchant.updateTenantInfo(getTenantInfo()); wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); - final PageInfo page = wxMerchantService.listVoAsPage(wxMerchant, pageNum, pageSize); + final PageInfo page = wxMerchantService.listVoAsPage(wxMerchant, pageNum, pageSize,false); return new ResultData(page); } @@ -76,7 +76,7 @@ public class WxMerchantController extends BaseController { if (null == wxMerchant) wxMerchant = new WxMerchant(); wxMerchant.updateTenantInfo(getTenantInfo()); wxMerchant.setSortColumns(BaseEntity.SortField.TopTime_DESC); - final PageInfo page = wxMerchantService.listVoAsPage2(wxMerchant, pageNum, pageSize); + final PageInfo page = wxMerchantService.listVoAsPage(wxMerchant, pageNum, pageSize,false); return new ResultData(page); } @@ -242,7 +242,7 @@ public class WxMerchantController extends BaseController { @SystemControllerLog(description = "商户-查询") public ResultData findMerchantById(Long id) { logger.debug("[" + getIpAddr() + "] WxMerchantController::findMerchantById"); - WxMerchantVo wxMerchant = wxMerchantService.findMerchantById(id); + WxMerchantVo wxMerchant = wxMerchantService.findMerchantById(getTenantInfo(),id); return new ResultData(wxMerchant); } diff --git a/mallinkTTCApi/src/main/java/com/iformall/controller/WxMerchantController.java b/mallinkTTCApi/src/main/java/com/iformall/controller/WxMerchantController.java index c6733d758..912610d1a 100644 --- a/mallinkTTCApi/src/main/java/com/iformall/controller/WxMerchantController.java +++ b/mallinkTTCApi/src/main/java/com/iformall/controller/WxMerchantController.java @@ -46,7 +46,7 @@ public class WxMerchantController extends BaseController { wxMerchantDto.updateTenantInfo(getParentTenantInfo()); wxMerchantDto.setMerchantStatus(EnumMerchantStatus.VALID.getCode()); wxMerchantDto.setIsPublic(EnumMerchantPublic.PUBLIC.getCode()); - return new ResultData(wxMerchantService.listAsPageCVo(wxMerchantDto, pageNum, pageSize)); + return new ResultData(wxMerchantService.listAsPageCVo(wxMerchantDto, pageNum, pageSize,true)); } @ApiOperation("分页列表接口")