lin hace 2 años
padre
commit
814062d42b
Se han modificado 11 ficheros con 292 adiciones y 328 borrados
  1. +23
    -0
      gptCApi/src/main/java/com/iformall/controller/WxNoticeController.java
  2. +4
    -308
      gptService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java
  3. +26
    -0
      gptService/src/main/java/com/iformall/domain/po/WxNotice.java
  4. +16
    -0
      gptService/src/main/java/com/iformall/mapper/WxNoticeMapper.java
  5. +25
    -0
      gptService/src/main/java/com/iformall/service/WxNoticeService.java
  6. +53
    -0
      gptService/src/main/java/com/iformall/service/cache/WxNoticeCache.java
  7. +15
    -15
      gptService/src/main/java/com/iformall/service/cache/WxProductCache.java
  8. +67
    -0
      gptService/src/main/java/com/iformall/service/impl/WxNoticeServiceImpl.java
  9. +3
    -3
      gptService/src/main/java/com/iformall/service/impl/WxProductServiceImpl.java
  10. +4
    -2
      gptService/src/main/java/com/iformall/utils/Constant.java
  11. +56
    -0
      gptService/src/main/resources/mapper/WxNoticeMapper.xml

+ 23
- 0
gptCApi/src/main/java/com/iformall/controller/WxNoticeController.java Ver fichero

@@ -0,0 +1,23 @@
package com.iformall.controller;

import com.iformall.common.ResultData;
import com.iformall.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/notice")
public class WxNoticeController extends BaseController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
WxNoticeService wxNoticeService;
@GetMapping("/list")
public ResultData list() {
return new ResultData(wxNoticeService.getCNoticeList(getCUser()));
}

}

+ 4
- 308
gptService/src/main/java/com/iformall/config/BaseMyBatisConfiguration.java Ver fichero

@@ -15,11 +15,11 @@ public class BaseMyBatisConfiguration {
protected MyBatisItercepters allIntercepters() {
MyBatisItercepters intercepters = new MyBatisItercepters();
// List<MyBatisPlus> plugins = new ArrayList<MyBatisPlus>();
List<MyBatisPlus> plugins = new ArrayList<MyBatisPlus>();
// plugins.add(multiTenancy());
// plugins.add(baseShardingSpherePlugin());
plugins.add(baseShardingSpherePlugin());
//
// intercepters.setPlugins(plugins);
intercepters.setPlugins(plugins);
return intercepters;
}

@@ -49,315 +49,11 @@ public class BaseMyBatisConfiguration {
ShardingSphere wxCouponrSharding = new ShardingSphere();
wxCouponrSharding.setColumn("tenant_id");
wxCouponrSharding.setTableName("wx_coupon");
wxCouponrSharding.setTableName("wx_pay_order");
wxCouponrSharding.setCount(100);
wxCouponrSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCouponrSharding);

ShardingSphere ttPoiTakeRateSharding = new ShardingSphere();
ttPoiTakeRateSharding.setColumn("tenant_id");
ttPoiTakeRateSharding.setTableName("tt_poi_take_rate");
ttPoiTakeRateSharding.setCount(100);
ttPoiTakeRateSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(ttPoiTakeRateSharding);

ShardingSphere wxCouponrMerchantSharding = new ShardingSphere();
wxCouponrMerchantSharding.setColumn("tenant_id");
wxCouponrMerchantSharding.setTableName("wx_coupon_merchant");
wxCouponrMerchantSharding.setCount(100);
wxCouponrMerchantSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCouponrMerchantSharding);
ShardingSphere wxCouponrChannelSharding = new ShardingSphere();
wxCouponrChannelSharding.setColumn("tenant_id");
wxCouponrChannelSharding.setTableName("wx_coupon_channel");
wxCouponrChannelSharding.setCount(100);
wxCouponrChannelSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCouponrChannelSharding);
ShardingSphere wxCUserSharding = new ShardingSphere();
wxCUserSharding.setColumn("tenant_id");
wxCUserSharding.setTableName("wx_c_user");
wxCUserSharding.setCount(100);
wxCUserSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCUserSharding);

ShardingSphere ttCUserSharding = new ShardingSphere();
ttCUserSharding.setColumn("tenant_id");
ttCUserSharding.setTableName("tt_c_user");
ttCUserSharding.setCount(100);
ttCUserSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(ttCUserSharding);

ShardingSphere wxMemberCardSharding = new ShardingSphere();
wxMemberCardSharding.setColumn("final_tenant_id");
wxMemberCardSharding.setTableName("wx_member_card");
wxMemberCardSharding.setCount(100);
wxMemberCardSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxMemberCardSharding);
ShardingSphere basicInfoSharding = new ShardingSphere();
basicInfoSharding.setColumn("final_tenant_id");
basicInfoSharding.setTableName("wx_c_user_basic_info");
basicInfoSharding.setCount(100);
basicInfoSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(basicInfoSharding);

ShardingSphere basicInfoAddressSharding = new ShardingSphere();
basicInfoAddressSharding.setColumn("final_tenant_id");
basicInfoAddressSharding.setTableName("user_basic_info_address");
basicInfoAddressSharding.setCount(100);
basicInfoAddressSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(basicInfoAddressSharding);

ShardingSphere mallCooUserInfoSharding = new ShardingSphere();
mallCooUserInfoSharding.setColumn("tenant_id");
mallCooUserInfoSharding.setTableName("mall_coo_user_info");
mallCooUserInfoSharding.setCount(100);
mallCooUserInfoSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(mallCooUserInfoSharding);

ShardingSphere basicSignSharding = new ShardingSphere();
basicSignSharding.setColumn("tenant_id");
basicSignSharding.setTableName("wx_c_user_basic_sign");
basicSignSharding.setCount(100);
basicSignSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(basicSignSharding);

ShardingSphere wxbasicChildSharding = new ShardingSphere();
wxbasicChildSharding.setColumn("tenant_id");
wxbasicChildSharding.setTableName("wx_c_user_basic_child");
wxbasicChildSharding.setCount(100);
wxbasicChildSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxbasicChildSharding);

ShardingSphere wxCUserFromSharding = new ShardingSphere();
wxCUserFromSharding.setColumn("tenant_id");
wxCUserFromSharding.setTableName("wx_c_user_from");
wxCUserFromSharding.setCount(100);
wxCUserFromSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCUserFromSharding);

ShardingSphere wxBusinessCircleOrderSharding = new ShardingSphere();
wxBusinessCircleOrderSharding.setColumn("tenant_id");
wxBusinessCircleOrderSharding.setTableName("wx_business_circle_order");
wxBusinessCircleOrderSharding.setCount(100);
wxBusinessCircleOrderSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxBusinessCircleOrderSharding);

ShardingSphere aliBusinessCircleOrderSharding = new ShardingSphere();
aliBusinessCircleOrderSharding.setColumn("tenant_id");
aliBusinessCircleOrderSharding.setTableName("ali_business_circle_order");
aliBusinessCircleOrderSharding.setCount(100);
aliBusinessCircleOrderSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(aliBusinessCircleOrderSharding);

ShardingSphere wxThirdPartyOrdersSharding = new ShardingSphere();
wxThirdPartyOrdersSharding.setColumn("tenant_id");
wxThirdPartyOrdersSharding.setTableName("wx_third_party_orders");
wxThirdPartyOrdersSharding.setCount(100);
wxThirdPartyOrdersSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxThirdPartyOrdersSharding);

ShardingSphere wxOrderSharding = new ShardingSphere();
wxOrderSharding.setColumn("tenant_id");
wxOrderSharding.setTableName("wx_order");
wxOrderSharding.setCount(100);
wxOrderSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxOrderSharding);

ShardingSphere orderCpsSharding = new ShardingSphere();
orderCpsSharding.setColumn("tenant_id");
orderCpsSharding.setTableName("order_cps");
orderCpsSharding.setCount(100);
orderCpsSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(orderCpsSharding);

ShardingSphere orderSnapshotSharding = new ShardingSphere();
orderSnapshotSharding.setColumn("tenant_id");
orderSnapshotSharding.setTableName("order_snapshot");
orderSnapshotSharding.setCount(100);
orderSnapshotSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(orderSnapshotSharding);
ShardingSphere wxPayOrderSharding = new ShardingSphere();
wxPayOrderSharding.setColumn("tenant_id");
wxPayOrderSharding.setTableName("wx_pay_order");
wxPayOrderSharding.setCount(100);
wxPayOrderSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxPayOrderSharding);
ShardingSphere wxCouponOrderSharding = new ShardingSphere();
wxCouponOrderSharding.setColumn("tenant_id");
wxCouponOrderSharding.setTableName("wx_coupon_order");
wxCouponOrderSharding.setCount(100);
wxCouponOrderSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCouponOrderSharding);
// ShardingSphere wxCouponSendSharding = new ShardingSphere();
// wxCouponSendSharding.setColumn("tenant_id");
// wxCouponSendSharding.setTableName("wx_coupon_send");
// wxCouponSendSharding.setCount(100);
// wxCouponSendSharding.setRule(EnumShardingRule.HASH.getCode());
// shardingList.add(wxCouponSendSharding);
ShardingSphere wxOrderGroupSharding = new ShardingSphere();
wxOrderGroupSharding.setColumn("tenant_id");
wxOrderGroupSharding.setTableName("wx_order_group");
wxOrderGroupSharding.setCount(100);
wxOrderGroupSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxOrderGroupSharding);
ShardingSphere wxOrderPressSharding = new ShardingSphere();
wxOrderPressSharding.setColumn("tenant_id");
wxOrderPressSharding.setTableName("wx_order_press");
wxOrderPressSharding.setCount(100);
wxOrderPressSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxOrderPressSharding);
ShardingSphere wxPosOrderSharding = new ShardingSphere();
wxPosOrderSharding.setColumn("tenant_id");
wxPosOrderSharding.setTableName("pos_order");
wxPosOrderSharding.setCount(100);
wxPosOrderSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxPosOrderSharding);
ShardingSphere wxPosPayOrderSharding = new ShardingSphere();
wxPosPayOrderSharding.setColumn("tenant_id");
wxPosPayOrderSharding.setTableName("pos_pay_order");
wxPosPayOrderSharding.setCount(100);
wxPosPayOrderSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxPosPayOrderSharding);
//TODO ,逻辑待处理,tenant_id未和basic_info的final_tenant_id对应,去掉parent_tenant_id
ShardingSphere wxScoreHistorySharding = new ShardingSphere();
wxScoreHistorySharding.setColumn("tenant_id");
wxScoreHistorySharding.setTableName("wx_score_history");
wxScoreHistorySharding.setCount(100);
wxScoreHistorySharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxScoreHistorySharding);
//TODO ,逻辑待处理,tenant_id未和basic_info的final_tenant_id对应,去掉parent_tenant_id
ShardingSphere wxCreditHistorySharding = new ShardingSphere();
wxCreditHistorySharding.setColumn("tenant_id");
wxCreditHistorySharding.setTableName("wx_credit_history");
wxCreditHistorySharding.setCount(100);
wxCreditHistorySharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCreditHistorySharding);
//TODO ,打标签定时任务。逻辑待处理,
ShardingSphere wxCUserTagsSharding = new ShardingSphere();
wxCUserTagsSharding.setColumn("tenant_id");
wxCUserTagsSharding.setTableName("wx_c_user_tags");
wxCUserTagsSharding.setCount(100);
wxCUserTagsSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCUserTagsSharding);
ShardingSphere wxCarCmdLogSharding = new ShardingSphere();
wxCarCmdLogSharding.setColumn("tenant_id");
wxCarCmdLogSharding.setTableName("wx_car_cmd_log");
wxCarCmdLogSharding.setCount(100);
wxCarCmdLogSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCarCmdLogSharding);
ShardingSphere wxMerchantSubsidySharding = new ShardingSphere();
wxMerchantSubsidySharding.setColumn("tenant_id");
wxMerchantSubsidySharding.setTableName("wx_merchant_subsidy");
wxMerchantSubsidySharding.setCount(100);
wxMerchantSubsidySharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxMerchantSubsidySharding);
ShardingSphere wxProfitSharingOrderSharding = new ShardingSphere();
wxProfitSharingOrderSharding.setColumn("tenant_id");
wxProfitSharingOrderSharding.setTableName("wx_profit_sharing_order");
wxProfitSharingOrderSharding.setCount(100);
wxProfitSharingOrderSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxProfitSharingOrderSharding);

ShardingSphere wxCouponActionLogSharding = new ShardingSphere();
wxCouponActionLogSharding.setColumn("tenant_id");
wxCouponActionLogSharding.setTableName("wx_coupon_action_log");
wxCouponActionLogSharding.setCount(100);
wxCouponActionLogSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCouponActionLogSharding);
ShardingSphere wxCarJSOrderSharding = new ShardingSphere();
wxCarJSOrderSharding.setColumn("car_number");
wxCarJSOrderSharding.setTableName("wx_car_js_order");
wxCarJSOrderSharding.setCount(100);
wxCarJSOrderSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCarJSOrderSharding);
ShardingSphere wxCashOutSharding = new ShardingSphere();
wxCashOutSharding.setColumn("tenant_id");
wxCashOutSharding.setTableName("wx_cash_out");
wxCashOutSharding.setCount(100);
wxCashOutSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCashOutSharding);
ShardingSphere alipayCUserSharding = new ShardingSphere();
alipayCUserSharding.setColumn("tenant_id");
alipayCUserSharding.setTableName("alipay_c_user");
alipayCUserSharding.setCount(100);
alipayCUserSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(alipayCUserSharding);
ShardingSphere wxComposeOrderSharding = new ShardingSphere();
wxComposeOrderSharding.setColumn("tenant_id");
wxComposeOrderSharding.setTableName("wx_batch_order");
wxComposeOrderSharding.setCount(100);
wxComposeOrderSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxComposeOrderSharding);
ShardingSphere wxPressBatchSharding = new ShardingSphere();
wxPressBatchSharding.setColumn("tenant_id");
wxPressBatchSharding.setTableName("wx_press_batch");
wxPressBatchSharding.setCount(100);
wxPressBatchSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxPressBatchSharding);
ShardingSphere wxPressBatchItemSharding = new ShardingSphere();
wxPressBatchItemSharding.setColumn("tenant_id");
wxPressBatchItemSharding.setTableName("wx_press_batch_item");
wxPressBatchItemSharding.setCount(100);
wxPressBatchItemSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxPressBatchItemSharding);
ShardingSphere wxCouponMallSharding = new ShardingSphere();
wxCouponMallSharding.setColumn("tenant_id");
wxCouponMallSharding.setTableName("wx_coupon_mall");
wxCouponMallSharding.setCount(100);
wxCouponMallSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCouponMallSharding);
ShardingSphere wxCarPayOrderSharding = new ShardingSphere();
wxCarPayOrderSharding.setColumn("tenant_id");
wxCarPayOrderSharding.setTableName("wx_car_pay_order");
wxCarPayOrderSharding.setCount(100);
wxCarPayOrderSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCarPayOrderSharding);
ShardingSphere wxCouponBatchSharding = new ShardingSphere();
wxCouponBatchSharding.setColumn("tenant_id");
wxCouponBatchSharding.setTableName("wx_coupon_batch");
wxCouponBatchSharding.setCount(100);
wxCouponBatchSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCouponBatchSharding);
ShardingSphere wxCouponBatchItemSharding = new ShardingSphere();
wxCouponBatchItemSharding.setColumn("tenant_id");
wxCouponBatchItemSharding.setTableName("wx_coupon_batch_item");
wxCouponBatchItemSharding.setCount(100);
wxCouponBatchItemSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxCouponBatchItemSharding);
ShardingSphere wxBusinessSharding = new ShardingSphere();
wxBusinessSharding.setColumn("final_tenant_id");
wxBusinessSharding.setTableName("wx_business");
wxBusinessSharding.setCount(100);
wxBusinessSharding.setRule(EnumShardingRule.HASH.getCode());
shardingList.add(wxBusinessSharding);
//初始化
shardingSpherePlugin.setShardingSpheres(shardingList);
Properties properties = new Properties();


+ 26
- 0
gptService/src/main/java/com/iformall/domain/po/WxNotice.java Ver fichero

@@ -0,0 +1,26 @@
package com.iformall.domain.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.iformall.domain.po.base.TenantEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.*;

@TableName(value = "wx_notice")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString
public class WxNotice extends TenantEntity {

private static final long serialVersionUID = -5094915301794376964L;

protected Long id;
@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime")
private Date createTime;
@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime")
private Date updateTime;
@io.swagger.annotations.ApiModelProperty(value="用户ID",name="cUserId")
private String content;
}

+ 16
- 0
gptService/src/main/java/com/iformall/mapper/WxNoticeMapper.java Ver fichero

@@ -0,0 +1,16 @@
package com.iformall.mapper;

import java.util.*;

import org.apache.ibatis.annotations.Param;

import com.iformall.common.CommonMapper;
import com.iformall.domain.po.WxNotice;

public interface WxNoticeMapper extends CommonMapper<WxNotice, Long> {

WxNotice selectById(@Param("id")Long id,@Param("tenantId")String tenantId);
List<WxNotice> findList(WxNotice wxCarPayOrder);
}

+ 25
- 0
gptService/src/main/java/com/iformall/service/WxNoticeService.java Ver fichero

@@ -0,0 +1,25 @@
package com.iformall.service;

import com.iformall.domain.po.WxNotice;
import com.iformall.domain.po.base.TenantEntity;

import java.util.List;

public interface WxNoticeService {


/**
* 根据Id获得实体
*
* @param id
* @return
*/
WxNotice getById(Long id,String tenantId);
List<WxNotice> list(WxNotice product);
List<WxNotice> getCNoticeList(TenantEntity tenantEntity);
WxNotice getCNotice(TenantEntity tenantEntity,Long id);
}

+ 53
- 0
gptService/src/main/java/com/iformall/service/cache/WxNoticeCache.java Ver fichero

@@ -0,0 +1,53 @@
package com.iformall.service.cache;

import java.util.List;

import org.springframework.data.redis.core.RedisTemplate;

import com.iformall.domain.po.WxNotice;
import com.iformall.utils.Constant;
import com.iformall.utils.RedisCacheUtils;

public class WxNoticeCache {

private static String getKey(Long noticeId) {
String key = Constant.noticePrev + noticeId;
return key;
}
public static WxNotice getCache(RedisTemplate<String, Object> redisTemplate,Long noticeId) {
String key = getKey(noticeId);
return RedisCacheUtils.getCacheObject(redisTemplate, key, WxNotice.class);
}
public static void cache(RedisTemplate<String, Object> redisTemplate,WxNotice notice) {
String key = getKey(notice.getId());
RedisCacheUtils.cache(redisTemplate, key, notice, 3600*24*7);
}
public static void removeCache(RedisTemplate<String, Object> redisTemplate,Long noticeId) {
String key = getKey(noticeId);
RedisCacheUtils.removeCache(redisTemplate, key);
}
private static String getListKey(String tenantId) {
String key = Constant.noticeListPrev + tenantId;
return key;
}
public static List<WxNotice> getCacheList(RedisTemplate<String, Object> redisTemplate,String tenantId) {
String key = getListKey(tenantId);
return RedisCacheUtils.getCacheListObject(redisTemplate, key, WxNotice.class);
}
public static void cacheList(RedisTemplate<String, Object> redisTemplate,List<WxNotice> wxNoticeList,String tenantId) {
String key = getListKey(tenantId);
RedisCacheUtils.cache(redisTemplate, key, wxNoticeList, 3600*24*7);
}
public static void removeCacheList(RedisTemplate<String, Object> redisTemplate,String tenantId) {
String key = getListKey(tenantId);
RedisCacheUtils.removeCache(redisTemplate, key);
}
}

+ 15
- 15
gptService/src/main/java/com/iformall/service/cache/WxProductCache.java Ver fichero

@@ -32,43 +32,43 @@ public class WxProductCache {
private static String getFirstKey() {
String key = Constant.productFirstPre;
private static String getFirstKey(String tenantId) {
String key = Constant.productFirstPre + tenantId;
return key;
}
public static WxProduct getCacheFirst(RedisTemplate<String, Object> redisTemplate) {
String key = getFirstKey();
public static WxProduct getCacheFirst(RedisTemplate<String, Object> redisTemplate,String tenantId) {
String key = getFirstKey(tenantId);
return RedisCacheUtils.getCacheObject(redisTemplate, key, WxProduct.class);
}
public static void cacheFirst(RedisTemplate<String, Object> redisTemplate,WxProduct wxProduct) {
String key = getFirstKey();
String key = getFirstKey(wxProduct.getTenantId());
RedisCacheUtils.cache(redisTemplate, key, wxProduct, 3600*24*7);
}
public static void removeCacheFirst(RedisTemplate<String, Object> redisTemplate) {
String key = getFirstKey();
public static void removeCacheFirst(RedisTemplate<String, Object> redisTemplate,String tenantId) {
String key = getFirstKey(tenantId);
RedisCacheUtils.removeCache(redisTemplate, key);
}
private static String getListKey() {
String key = Constant.productListPre;
private static String getListKey(String tenantId) {
String key = Constant.productListPre + tenantId;
return key;
}
public static List<WxProduct> getCacheList(RedisTemplate<String, Object> redisTemplate) {
String key = getListKey();
public static List<WxProduct> getCacheList(RedisTemplate<String, Object> redisTemplate,String tenantId) {
String key = getListKey(tenantId);
return RedisCacheUtils.getCacheListObject(redisTemplate, key, WxProduct.class);
}
public static void cacheList(RedisTemplate<String, Object> redisTemplate,List<WxProduct> wxProductList) {
String key = getListKey();
public static void cacheList(RedisTemplate<String, Object> redisTemplate,List<WxProduct> wxProductList,String tenantId) {
String key = getListKey(tenantId);
RedisCacheUtils.cache(redisTemplate, key, wxProductList, 3600*24*7);
}
public static void removeCacheList(RedisTemplate<String, Object> redisTemplate) {
String key = getListKey();
public static void removeCacheList(RedisTemplate<String, Object> redisTemplate,String tenantId) {
String key = getListKey(tenantId);
RedisCacheUtils.removeCache(redisTemplate, key);
}


+ 67
- 0
gptService/src/main/java/com/iformall/service/impl/WxNoticeServiceImpl.java Ver fichero

@@ -0,0 +1,67 @@
package com.iformall.service.impl;

import com.iformall.domain.po.*;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.mapper.WxNoticeMapper;
import com.iformall.service.*;
import com.iformall.service.cache.WxNoticeCache;
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.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class WxNoticeServiceImpl implements WxNoticeService {
private final Logger logger = LoggerFactory.getLogger(this.getClass());

@Autowired
WxNoticeMapper wxNoticeMapper;
@Autowired
@Qualifier("objectCommonRedisTemplate")
RedisTemplate<String, Object> objectCommonRedisTemplate;

@Override
public WxNotice getById(Long id, String tenantId) {
return wxNoticeMapper.selectById(id, tenantId);
}

@Override
public List<WxNotice> list(WxNotice product) {
return wxNoticeMapper.findList(product);
}

@Override
public List<WxNotice> getCNoticeList(TenantEntity tenantEntity) {
List<WxNotice> productList = WxNoticeCache.getCacheList(objectCommonRedisTemplate,tenantEntity.getTenantId());
if (null == productList || productList.size() <= 0 ) {
WxNotice p = new WxNotice();
p.updateTenantInfo(tenantEntity);
List<WxNotice> plist = list(p);
if (null != plist && plist.size() > 0 ) {
WxNoticeCache.cacheList(objectCommonRedisTemplate, plist,tenantEntity.getTenantId());
return plist;
}
}
return productList;
}


@Override
public WxNotice getCNotice(TenantEntity tenantEntity,Long id) {
WxNotice _product = WxNoticeCache.getCache(objectCommonRedisTemplate,id);
if (null == _product) {
_product = getById(id, tenantEntity.getTenantId());
if (null != _product) {
WxNoticeCache.cache(objectCommonRedisTemplate, _product);
}
}
return _product;
}


}

+ 3
- 3
gptService/src/main/java/com/iformall/service/impl/WxProductServiceImpl.java Ver fichero

@@ -37,14 +37,14 @@ public class WxProductServiceImpl implements WxProductService {

@Override
public List<WxProduct> getCProductList(TenantEntity tenantEntity) {
List<WxProduct> productList = WxProductCache.getCacheList(objectCommonRedisTemplate);
List<WxProduct> productList = WxProductCache.getCacheList(objectCommonRedisTemplate,tenantEntity.getTenantId());
if (null == productList || productList.size() <= 0 ) {
WxProduct p = new WxProduct();
p.updateTenantInfo(tenantEntity);
p.setFirst(EnumYesOrNo.NO.getCode());
List<WxProduct> plist = productList(p);
if (null != plist && plist.size() > 0 ) {
WxProductCache.cacheList(objectCommonRedisTemplate, plist);
WxProductCache.cacheList(objectCommonRedisTemplate, plist,tenantEntity.getTenantId());
return plist;
}
}
@@ -53,7 +53,7 @@ public class WxProductServiceImpl implements WxProductService {

@Override
public WxProduct getCFirstProduct(TenantEntity tenantEntity) {
WxProduct _product = WxProductCache.getCacheFirst(objectCommonRedisTemplate);
WxProduct _product = WxProductCache.getCacheFirst(objectCommonRedisTemplate,tenantEntity.getTenantId());
if (null == _product) {
WxProduct p = new WxProduct();
p.updateTenantInfo(tenantEntity);


+ 4
- 2
gptService/src/main/java/com/iformall/utils/Constant.java Ver fichero

@@ -6,9 +6,11 @@ public class Constant {
public static final String appinfoPrev = "gpt:appinfo:";
public static final String cuserPre = "gpt:wxCUser:";
public static final String productPre = "gpt:wxProduct:";
public static final String productFirstPre = "gpt:wxProductFirst";
public static final String productListPre = "gpt:wxProductList";
public static final String productFirstPre = "gpt:wxProductFirst:";
public static final String productListPre = "gpt:wxProductList:";
public static final String payaccountPrev = "gpt:payAccount:";
public static final String noticePrev = "gpt:notice:";
public static final String noticeListPrev = "gpt:noticeList:";
public static final String currentUser = "currentUser";
public static final String TENANT_ID = "tenantId";
public static final String PARENT_TENANT_ID = "parentTenantId";


+ 56
- 0
gptService/src/main/resources/mapper/WxNoticeMapper.xml Ver fichero

@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.iformall.mapper.WxNoticeMapper">
<resultMap id="BaseResultMap" type="com.iformall.domain.po.WxNotice">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
<result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="content" jdbcType="VARCHAR" property="content"/>
</resultMap>

<sql id="allColumns">
`id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`content`
</sql>

<sql id="dynamicWhereConditions">
where `tenant_id` = #{tenantId}

<if test=" null != id ">
and `id` = #{id}
</if>

<if test=" null != parentTenantId and '' != parentTenantId">
and `parent_tenant_id` = #{parentTenantId}
</if>

<if test=" null != createTime ">
and `create_time` = #{createTime}
</if>

<if test=" null != updateTime ">
and `update_time` = #{updateTime}
</if>

<if test=" null != ids ">
and id in
<foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
#{idItem}
</foreach>
</if>
<if test=" null != sortColumns">order by ${sortColumns}</if>
</sql>

<select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap">
select <include refid="allColumns"/> from wx_notice where id = #{id} and tenant_id = #{tenantId}
</select>

<select id="findList" parameterType="com.iformall.domain.po.WxNotice" resultMap="BaseResultMap">
select
<include refid="allColumns"/>
from wx_notice
<include refid="dynamicWhereConditions"/>
</select>

</mapper>

Cargando…
Cancelar
Guardar