diff --git a/hai-cweb/src/main/java/com/cweb/controller/BsMsgController.java b/hai-cweb/src/main/java/com/cweb/controller/BsMsgController.java index 5e47fe29..02d2bdb4 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/BsMsgController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/BsMsgController.java @@ -89,10 +89,34 @@ public class BsMsgController { SessionObject sessionObject = userCenter.getSessionObject(request); HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + bsMsgService.checkMsg(userInfoModel.getHighUser(), msgId); + return ResponseMsgUtil.success(null); + } catch (Exception e) { + log.error("HighOrderController -> addOrder() error!", e); + return ResponseMsgUtil.exception(e); + } + } - return ResponseMsgUtil.success(null); + @RequestMapping(value = "/queryMsgByList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询站内信列表") + public ResponseData queryMsgByList(@RequestParam(value = "companyId", required = false) Long companyId, HttpServletRequest request) { + try { + + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + Map map = new HashMap<>(); + + map.put("companyId" , companyId); + map.put("userId" , userInfoModel.getHighUser().getId()); + + bsMsgService.queryMsgByList(map); + + return ResponseMsgUtil.success(bsMsgService.queryMsgByList(map)); } catch (Exception e) { log.error("HighOrderController -> addOrder() error!", e); diff --git a/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java b/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java index a4939137..00fe7929 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java @@ -4,10 +4,13 @@ import com.alibaba.fastjson.JSONObject; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; +import com.hai.common.security.SessionObject; +import com.hai.common.security.UserCenter; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.CmsContentConfig; import com.hai.entity.*; import com.hai.model.CmsContentModel; +import com.hai.model.HighUserModel; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; import com.hai.service.*; @@ -16,6 +19,7 @@ import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; @@ -45,14 +49,24 @@ public class CmsContentController { @Resource private CmsContentConfig cmsContentConfig; + @Resource + private BsMsgService bsMsgService; + + @Autowired + private UserCenter userCenter; + @RequestMapping(value = "/getCmsContent", method = RequestMethod.GET) - @ApiOperation(value = "查询首页轮播图") + @ApiOperation(value = "查询cms内容") @ResponseBody public ResponseData getCmsContent(@RequestParam(name = "companyId", required = true) Long companyId, @RequestParam(name = "platform", required = true) Integer platform, - @RequestParam(name = "categoryCode", required = true) String categoryCode) { + @RequestParam(name = "categoryCode", required = true) String categoryCode, HttpServletRequest request) { try { + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + CmsCategory category = cmsCategoryService.getCategoryByCode(categoryCode); if (category == null) { @@ -89,7 +103,17 @@ public class CmsContentController { object.put("name" , cmsCategory.getName()); object.put("sort" , cmsCategory.getSort()); object.put("code" , cmsCategory.getCode()); - object.put("childDate" , null); + List cmsContent = cmsContentService.getListCmsContentByCategoryId(cmsCategory.getId() , companyId , platform); + object.put("jumpType" , cmsContent.get(0).getJumpType()); + object.put("jumpUrl" , cmsContent.get(0).getJumpUrl()); + + Map map = new HashMap<>(); + + map.put("companyId" , companyId); + map.put("whereCheck" , false); + map.put("userId" , userInfoModel.getHighUser().getId()); + + object.put("childDate" , bsMsgService.queryMsgByList(map)); } objectList.add(object); } diff --git a/hai-msg/src/main/java/com/MsgApplication.java b/hai-msg/src/main/java/com/MsgApplication.java index ae0bfa1b..7f30ce53 100644 --- a/hai-msg/src/main/java/com/MsgApplication.java +++ b/hai-msg/src/main/java/com/MsgApplication.java @@ -1,5 +1,7 @@ package com; +import com.alicp.jetcache.anno.config.EnableCreateCacheAnnotation; +import com.alicp.jetcache.anno.config.EnableMethodCache; import com.hai.common.utils.SpringContextUtil; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; @@ -11,11 +13,12 @@ import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.transaction.annotation.EnableTransactionManagement; @SpringBootApplication -// @ComponentScan +//@ComponentScan @EnableTransactionManagement @EnableScheduling +@EnableMethodCache(basePackages = "com.hai") +@EnableCreateCacheAnnotation @ServletComponentScan -@EnableAspectJAutoProxy(proxyTargetClass = true) @MapperScan("com.hai.dao") public class MsgApplication { diff --git a/hai-msg/src/main/resources/dev/application.yml b/hai-msg/src/main/resources/dev/application.yml index 3828365e..c12c24ef 100644 --- a/hai-msg/src/main/resources/dev/application.yml +++ b/hai-msg/src/main/resources/dev/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hfkj?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://139.159.177.244:3306/hsg_order?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource @@ -32,22 +32,68 @@ spring: host: 139.159.177.244 port: 36379 password: HF123456.Redis - timeout: 36000000 + timeout: 1000 jedis: pool: max-active: 20 max-wait: -1 max-idle: 10 min-idle: 0 + #MQTT配置信息 + mqtt: + #MQTT服务地址 + url: ws://139.159.177.244:8083/mqtt + #用户名 + username: printer_provider + #密码 + password: 123654 + #客户端id(不能重复) + # client: + # id: provider-id + #MQTT默认的消息推送主题,实际可在调用接口是指定 + # default: + # topic: topic +rocketmq: + name-server: 139.159.177.244:9876 + producer: + #必须指定group + group: default-group + #配置日期返回至前台为时间戳 jackson: serialization: write-dates-as-timestamps: true mybatis: mapperLocations: - - classpath*:sqlmap*/*.xml + - classpath*:sqlmap*/*.xml type-aliases-package: org.springboot.sample.entity + configuration: + log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + #开启MyBatis的二级缓存 + cache-enabled: true + +jetcache: + statIntervalMinutes: 15 + areaInCacheName: false + local: + default: + type: linkedhashmap + keyConvertor: fastjson + remote: + default: + type: redis + host: 139.159.177.244 + port: 36379 + password: HF123456.Redis + keyConvertor: fastjson + broadcastChannel: projectA + valueEncoder: java + valueDecoder: java + poolConfig: + minIdle: 5 + maxIdle: 20 + maxTotal: 50 pagehelper: helperDialect: mysql diff --git a/hai-service/src/main/java/com/hai/config/CmsContentConfig.java b/hai-service/src/main/java/com/hai/config/CmsContentConfig.java index a9dcf7e0..636af62f 100644 --- a/hai-service/src/main/java/com/hai/config/CmsContentConfig.java +++ b/hai-service/src/main/java/com/hai/config/CmsContentConfig.java @@ -41,7 +41,14 @@ public class CmsContentConfig { map.put("status" , 1); PageHelper.startPage(1, 3); return new PageInfo<>( highDiscountPackageService.getDiscountPackageList(map)).getList(); - } else { + } else if (CmsContentDataEnum.REFUEL.getName().equals(title)){ + map.put("companyId", companyId); + map.put("displayArea", CmsContentDataEnum.getTypeByName(title)); + map.put("notCouponSource", 2); + map.put("status", 2); + PageHelper.startPage(1, 3); + return new PageInfo<>(highCouponService.getCouponList(map)).getList(); + } else if (CmsContentDataEnum.MSG.getName().equals(title)){ map.put("companyId", companyId); map.put("displayArea", CmsContentDataEnum.getTypeByName(title)); map.put("notCouponSource", 2); @@ -49,6 +56,7 @@ public class CmsContentConfig { PageHelper.startPage(1, 3); return new PageInfo<>(highCouponService.getCouponList(map)).getList(); } + return null; } diff --git a/hai-service/src/main/java/com/hai/dao/BsMsgUserMapperExt.java b/hai-service/src/main/java/com/hai/dao/BsMsgUserMapperExt.java index f263c72d..ec44e9d0 100644 --- a/hai-service/src/main/java/com/hai/dao/BsMsgUserMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/BsMsgUserMapperExt.java @@ -1,7 +1,48 @@ package com.hai.dao; +import com.hai.entity.BsMsg; +import com.hai.entity.OutRechargePrice; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Result; +import org.apache.ibatis.annotations.Results; +import org.apache.ibatis.annotations.Select; +import org.apache.ibatis.type.JdbcType; + +import java.util.List; +import java.util.Map; + /** * mapper扩展类 */ public interface BsMsgUserMapperExt { -} \ No newline at end of file + + @Select({""}) + @Results({ + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR), + @Result(column="type", property="type", jdbcType=JdbcType.INTEGER), + @Result(column="jump_type", property="jumpType", jdbcType=JdbcType.INTEGER), + @Result(column="msg_type", property="msgType", jdbcType=JdbcType.INTEGER), + @Result(column="object_id", property="objectId", jdbcType=JdbcType.BIGINT), + @Result(column="image", property="image", jdbcType=JdbcType.VARCHAR), + @Result(column="content", property="content", jdbcType=JdbcType.VARCHAR), + @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="op_name", property="opName", jdbcType=JdbcType.VARCHAR), + @Result(column="company_id", property="companyId", jdbcType=JdbcType.BIGINT), + @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP), + @Result(column="op_id", property="opId", jdbcType=JdbcType.BIGINT), + @Result(column="status", property="status", jdbcType=JdbcType.INTEGER), + @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), + @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) + }) + List queryMsgByList(@Param("param") Map param); + +} diff --git a/hai-service/src/main/java/com/hai/enum_type/CmsContentDataEnum.java b/hai-service/src/main/java/com/hai/enum_type/CmsContentDataEnum.java index 060952ac..c631426b 100644 --- a/hai-service/src/main/java/com/hai/enum_type/CmsContentDataEnum.java +++ b/hai-service/src/main/java/com/hai/enum_type/CmsContentDataEnum.java @@ -17,6 +17,7 @@ public enum CmsContentDataEnum { PREFERABLY(4 , "优选商品"), UNION_CARD(5 , "工会卡专区"), DISCOUNT(6 , "天天好券"), + MSG(90 , "消息通知"), ; private Integer type; @@ -34,6 +35,8 @@ public enum CmsContentDataEnum { } return null; } + + public Integer getType() { return type; } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java index 2ec159a5..6dfb58fb 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java @@ -286,4 +286,6 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { } } + + } diff --git a/hai-service/src/main/java/com/hai/service/BsMsgService.java b/hai-service/src/main/java/com/hai/service/BsMsgService.java index 8a9a6826..745baaf3 100644 --- a/hai-service/src/main/java/com/hai/service/BsMsgService.java +++ b/hai-service/src/main/java/com/hai/service/BsMsgService.java @@ -76,5 +76,15 @@ public interface BsMsgService { */ List findMsgUserById(Long userId , Long msgId); + /** + * @Author Sum1Dream + * @Name queryMsgByList + * @Description // 查询站内信 + * @Date 16:29 2022/10/17 + * @Param [map] + * @Return java.util.List + */ + List queryMsgByList(Map map); + } diff --git a/hai-service/src/main/java/com/hai/service/impl/BsMsgServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/BsMsgServiceImpl.java index 7a518aba..51530985 100644 --- a/hai-service/src/main/java/com/hai/service/impl/BsMsgServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/BsMsgServiceImpl.java @@ -127,4 +127,9 @@ public class BsMsgServiceImpl implements BsMsgService { return bsMsgUserMapper.selectByExample(example); } + + @Override + public List queryMsgByList(Map map) { + return bsMsgUserMapper.queryMsgByList(map); + } }