Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/haizhentong
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TSysActivity; |
| | | import com.ruoyi.system.query.TSysActivityQuery; |
| | | import com.ruoyi.system.service.TSysActivityService; |
| | | import com.ruoyi.system.vo.TSysActivityVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | private final TSysActivityService sysActivityService; |
| | | private final TokenService tokenService; |
| | | private final RedisCache redisCache; |
| | | @Autowired |
| | | public TSysActivityController(TSysActivityService sysActivityService, TokenService tokenService) { |
| | | public TSysActivityController(TSysActivityService sysActivityService, TokenService tokenService, RedisCache redisCache) { |
| | | this.sysActivityService = sysActivityService; |
| | | this.tokenService = tokenService; |
| | | this.redisCache = redisCache; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiOperation(value = "获取热门活动分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TSysActivity>> pageList(@RequestBody TSysActivityQuery query) { |
| | | public R<PageInfo<TSysActivityVO>> pageList(@RequestBody TSysActivityQuery query) { |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | if(roleType == 5){ |
| | | query.setRoleType(roleType); |
| | | query.setUserId(userId); |
| | | } |
| | | return R.ok(sysActivityService.pageList(query)); |
| | | } |
| | |
| | | @ApiOperation(value = "查看热门活动详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TSysActivity> getDetailById(@RequestParam String id) { |
| | | return R.ok(sysActivityService.getById(id)); |
| | | TSysActivity sysActivity = sysActivityService.getById(id); |
| | | // 查询次数自增 使用数据库原子更新操作 |
| | | sysActivityService.update( |
| | | Wrappers.<TSysActivity>lambdaUpdate() |
| | | .setSql("click_count = click_count + 1") |
| | | .eq(TSysActivity::getId, id) |
| | | ); |
| | | // 如果是诊所 |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | if(roleType == 5){ |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | Set<Long> clickCount = new HashSet<>(); |
| | | clickCount.add(userId); |
| | | redisCache.setCacheSet(Constants.SYS_ACTIVITY_CLICK_COUNT+id,clickCount); |
| | | } |
| | | return R.ok(sysActivity); |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 分公司管理解冻冻结 |
| | | */ |
| | | @Log(title = "用户管理信息-分公司管理解冻冻结", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "分公司管理解冻冻结",notes = "状态 1=使用中 2=冻结") |
| | | @Log(title = "用户管理信息-用户管理解冻冻结", businessType = BusinessType.UPDATE) |
| | | @ApiOperation(value = "用户管理解冻冻结",notes = "状态 1=使用中 2=冻结") |
| | | @PutMapping(value = "/thawOrFreeze") |
| | | public R<Boolean> thawOrFreeze(@RequestParam(value = "id")String id, |
| | | @RequestParam(value = "status")Integer status) { |
| | |
| | | @ApiOperation(value = "修改系统配置-协议管理管理") |
| | | @PostMapping(value = "/update") |
| | | public R<Boolean> update(@Validated @RequestBody TSysConfig dto) { |
| | | return R.ok(sysConfigService.updateById(dto)); |
| | | TSysConfig sysConfig = sysConfigService.getOne(Wrappers.<TSysConfig>lambdaQuery().eq(TSysConfig::getConfigType, dto.getConfigType()) |
| | | .last("LIMIT 1")); |
| | | sysConfig.setContent(dto.getContent()); |
| | | return R.ok(sysConfigService.updateById(sysConfig)); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TSysEducationalInfo; |
| | | import com.ruoyi.system.query.TSysEducationalInfoQuery; |
| | | import com.ruoyi.system.service.TSysEducationalInfoService; |
| | | import com.ruoyi.system.vo.TSysEducationalInfoVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | private final TSysEducationalInfoService sysEducationalInfoService; |
| | | private final TokenService tokenService; |
| | | private final RedisCache redisCache; |
| | | @Autowired |
| | | public TSysEducationalInfoController(TSysEducationalInfoService sysEducationalInfoService, TokenService tokenService) { |
| | | public TSysEducationalInfoController(TSysEducationalInfoService sysEducationalInfoService, TokenService tokenService, RedisCache redisCache) { |
| | | this.sysEducationalInfoService = sysEducationalInfoService; |
| | | this.tokenService = tokenService; |
| | | this.redisCache = redisCache; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiOperation(value = "获取教育资讯分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TSysEducationalInfo>> pageList(@RequestBody TSysEducationalInfoQuery query) { |
| | | public R<PageInfo<TSysEducationalInfoVO>> pageList(@RequestBody TSysEducationalInfoQuery query) { |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | if(roleType == 5){ |
| | | query.setRoleType(roleType); |
| | | query.setUserId(userId); |
| | | } |
| | | return R.ok(sysEducationalInfoService.pageList(query)); |
| | | } |
| | |
| | | @ApiOperation(value = "查看教育资讯详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TSysEducationalInfo> getDetailById(@RequestParam String id) { |
| | | return R.ok(sysEducationalInfoService.getById(id)); |
| | | TSysEducationalInfo sysEducationalInfo = sysEducationalInfoService.getById(id); |
| | | // 查询次数自增 使用数据库原子更新操作 |
| | | sysEducationalInfoService.update( |
| | | Wrappers.<TSysEducationalInfo>lambdaUpdate() |
| | | .setSql("click_count = click_count + 1") |
| | | .eq(TSysEducationalInfo::getId, id) |
| | | ); |
| | | // 如果是诊所 |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | if(roleType == 5){ |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | Set<Long> clickCount = new HashSet<>(); |
| | | clickCount.add(userId); |
| | | redisCache.setCacheSet(Constants.SYS_EDUCATION_CLICK_COUNT+id,clickCount); |
| | | } |
| | | return R.ok(sysEducationalInfo); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TSysLive; |
| | | import com.ruoyi.system.model.TSysProductIntroduction; |
| | | import com.ruoyi.system.query.TSysLiveQuery; |
| | | import com.ruoyi.system.service.TSysLiveService; |
| | | import com.ruoyi.system.vo.TSysLiveVO; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | private final TSysLiveService sysLiveService; |
| | | private final TokenService tokenService; |
| | | private final RedisCache redisCache; |
| | | @Autowired |
| | | public TSysLiveController(TSysLiveService sysLiveService, TokenService tokenService) { |
| | | public TSysLiveController(TSysLiveService sysLiveService, TokenService tokenService, RedisCache redisCache) { |
| | | this.sysLiveService = sysLiveService; |
| | | this.tokenService = tokenService; |
| | | this.redisCache = redisCache; |
| | | } |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value = "获取直播管理分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TSysLiveVO>> pageList(@RequestBody TSysLiveQuery query) { |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | if(roleType == 5){ |
| | | query.setRoleType(roleType); |
| | | query.setUserId(userId); |
| | | } |
| | | return R.ok(sysLiveService.pageList(query)); |
| | | } |
| | | |
| | |
| | | @ApiOperation(value = "查看直播管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TSysLive> getDetailById(@RequestParam String id) { |
| | | return R.ok(sysLiveService.getById(id)); |
| | | TSysLive sysLive = sysLiveService.getById(id); |
| | | // 查询次数自增 使用数据库原子更新操作 |
| | | sysLiveService.update( |
| | | Wrappers.<TSysLive>lambdaUpdate() |
| | | .setSql("click_count = click_count + 1") |
| | | .eq(TSysLive::getId, id) |
| | | ); |
| | | // 如果是诊所 |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | if(roleType == 5){ |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | Set<Long> clickCount = new HashSet<>(); |
| | | clickCount.add(userId); |
| | | redisCache.setCacheSet(Constants.SYS_LIVE_COUNT+id,clickCount); |
| | | } |
| | | return R.ok(sysLive); |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TSysProductIntroduction; |
| | | import com.ruoyi.system.query.TSysProductIntroductionQuery; |
| | | import com.ruoyi.system.service.TSysProductIntroductionService; |
| | | import com.ruoyi.system.vo.TSysProductIntroductionVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | private final TSysProductIntroductionService sysProductIntroductionService; |
| | | private final TokenService tokenService; |
| | | private final RedisCache redisCache; |
| | | @Autowired |
| | | public TSysProductIntroductionController(TSysProductIntroductionService sysProductIntroductionService, TokenService tokenService) { |
| | | public TSysProductIntroductionController(TSysProductIntroductionService sysProductIntroductionService, TokenService tokenService, RedisCache redisCache) { |
| | | this.sysProductIntroductionService = sysProductIntroductionService; |
| | | this.tokenService = tokenService; |
| | | this.redisCache = redisCache; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiOperation(value = "获取产品介绍分页列表") |
| | | @PostMapping(value = "/pageList") |
| | | public R<PageInfo<TSysProductIntroduction>> pageList(@RequestBody TSysProductIntroductionQuery query) { |
| | | public R<PageInfo<TSysProductIntroductionVO>> pageList(@RequestBody TSysProductIntroductionQuery query) { |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | if(roleType == 5){ |
| | | query.setRoleType(roleType); |
| | | query.setUserId(userId); |
| | | } |
| | | return R.ok(sysProductIntroductionService.pageList(query)); |
| | | } |
| | |
| | | @ApiOperation(value = "查看产品介绍详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TSysProductIntroduction> getDetailById(@RequestParam String id) { |
| | | return R.ok(sysProductIntroductionService.getById(id)); |
| | | TSysProductIntroduction sysProductIntroduction = sysProductIntroductionService.getById(id); |
| | | // 查询次数自增 使用数据库原子更新操作 |
| | | sysProductIntroductionService.update( |
| | | Wrappers.<TSysProductIntroduction>lambdaUpdate() |
| | | .setSql("click_count = click_count + 1") |
| | | .eq(TSysProductIntroduction::getId, id) |
| | | ); |
| | | // 如果是诊所 |
| | | Integer roleType = tokenService.getLoginUser().getUser().getRoleType(); |
| | | if(roleType == 5){ |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | Set<Long> clickCount = new HashSet<>(); |
| | | clickCount.add(userId); |
| | | redisCache.setCacheSet(Constants.SYS_PRODUCT_CLICK_COUNT+id,clickCount); |
| | | } |
| | | return R.ok(sysProductIntroduction); |
| | | } |
| | | |
| | | /** |
| | |
| | | conf: |
| | | appId: wx75922efb57320f77 |
| | | secretId: 7a2aa1f837b7aeb3bc24a6b569c65110 |
| | | appLiveResultTemplateId: 1wheNdyQ88Cz9Z7L1EXxR2L0u4X4LaeXoZVtZwHCagk |
| | | officeAppLiveResultTemplateId: 7w1JVe3S4ClFnff7g8us7x-hqFuV3f2SKjKclP_X2FI |
| | | #OSS及短信配置 |
| | | code: |
| | | config: |
| | |
| | | conf: |
| | | appId: wxa17e8d1331e50934 |
| | | secretId: 79c234527fd3b6553679d52be5e29b19 |
| | | appLiveResultTemplateId: 1wheNdyQ88Cz9Z7L1EXxR2L0u4X4LaeXoZVtZwHCagk |
| | | officeAppLiveResultTemplateId: 7w1JVe3S4ClFnff7g8us7x-hqFuV3f2SKjKclP_X2FI |
| | | lakala: |
| | | MerchantNo: 822290059430BFA |
| | | TermNo: D9261078 |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @ApiOperation(value = "查看热门活动详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TSysActivity> getDetailById(@RequestParam String id) { |
| | | return R.ok(sysActivityService.getById(id)); |
| | | TSysActivity sysActivity = sysActivityService.getById(id); |
| | | // 查询次数自增 使用数据库原子更新操作 |
| | | sysActivityService.update( |
| | | Wrappers.<TSysActivity>lambdaUpdate() |
| | | .setSql("click_count = click_count + 1") |
| | | .eq(TSysActivity::getId, id) |
| | | ); |
| | | return R.ok(sysActivity); |
| | | } |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TSysActivity; |
| | | import com.ruoyi.system.model.TSysEducationalInfo; |
| | | import com.ruoyi.system.query.TSysEducationalInfoQuery; |
| | | import com.ruoyi.system.service.TSysEducationalInfoService; |
| | |
| | | @ApiOperation(value = "查看教育资讯详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TSysEducationalInfo> getDetailById(@RequestParam String id) { |
| | | return R.ok(sysEducationalInfoService.getById(id)); |
| | | TSysEducationalInfo sysEducationalInfo = sysEducationalInfoService.getById(id); |
| | | // 查询次数自增 使用数据库原子更新操作 |
| | | sysEducationalInfoService.update( |
| | | Wrappers.<TSysEducationalInfo>lambdaUpdate() |
| | | .setSql("click_count = click_count + 1") |
| | | .eq(TSysEducationalInfo::getId, id) |
| | | ); |
| | | return R.ok(sysEducationalInfo); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.google.common.collect.ImmutableMap; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.Constants; |
| | |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TSysLive; |
| | | import com.ruoyi.system.query.TSysLiveQuery; |
| | | import com.ruoyi.system.service.TSysLiveService; |
| | | import com.ruoyi.system.task.base.QuartzManager; |
| | | import com.ruoyi.system.task.base.TimeJobType; |
| | | import com.ruoyi.system.task.jobs.LivePushJob; |
| | | import com.ruoyi.system.vo.TSysLiveVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import java.time.LocalDateTime; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | |
| | | @ApiOperation(value = "查看直播管理详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TSysLive> getDetailById(@RequestParam String id) { |
| | | return R.ok(sysLiveService.getById(id)); |
| | | TSysLive sysLive = sysLiveService.getById(id); |
| | | // 查询次数自增 使用数据库原子更新操作 |
| | | sysLiveService.update( |
| | | Wrappers.<TSysLive>lambdaUpdate() |
| | | .setSql("click_count = click_count + 1") |
| | | .eq(TSysLive::getId, id) |
| | | ); |
| | | return R.ok(sysLive); |
| | | } |
| | | |
| | | /** |
| | |
| | | Set<String> appointmentPush = new HashSet<>(); |
| | | appointmentPush.add(userId); |
| | | redisCache.setCacheSet(Constants.LIVE_APPOINTMENT_PUSH + id, appointmentPush); |
| | | |
| | | TSysLive sysLive = sysLiveService.getById(id); |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", sysLive.getId()) |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | LivePushJob.class, |
| | | (LivePushJob.name+sysLive.getId()).toUpperCase(), |
| | | TimeJobType.LIVE_PUSH, |
| | | DateUtils.localDateTimeToDate(sysLive.getStartTime().minusHours(1)), |
| | | maps |
| | | ); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.model.TSysEducationalInfo; |
| | | import com.ruoyi.system.model.TSysProductIntroduction; |
| | | import com.ruoyi.system.query.TSysProductIntroductionQuery; |
| | | import com.ruoyi.system.service.TSysProductIntroductionService; |
| | |
| | | @ApiOperation(value = "查看产品介绍详情") |
| | | @GetMapping(value = "/getDetailById") |
| | | public R<TSysProductIntroduction> getDetailById(@RequestParam String id) { |
| | | return R.ok(sysProductIntroductionService.getById(id)); |
| | | TSysProductIntroduction sysProductIntroduction = sysProductIntroductionService.getById(id); |
| | | // 查询次数自增 使用数据库原子更新操作 |
| | | sysProductIntroductionService.update( |
| | | Wrappers.<TSysProductIntroduction>lambdaUpdate() |
| | | .setSql("click_count = click_count + 1") |
| | | .eq(TSysProductIntroduction::getId, id) |
| | | ); |
| | | return R.ok(sysProductIntroduction); |
| | | } |
| | | |
| | | } |
| | |
| | | @PostMapping("/getWXToken") |
| | | public R<String> getWXToken(){ |
| | | WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, wxConfig, redisService); |
| | | String accessToken = appletTools.getAccessToken(""); |
| | | String accessToken = appletTools.getAccessToken(); |
| | | return R.ok(accessToken); |
| | | } |
| | | |
| | |
| | | conf: |
| | | appId: wx75922efb57320f77 |
| | | secretId: 7a2aa1f837b7aeb3bc24a6b569c65110 |
| | | appLiveResultTemplateId: 1wheNdyQ88Cz9Z7L1EXxR2L0u4X4LaeXoZVtZwHCagk |
| | | officeAppLiveResultTemplateId: 7w1JVe3S4ClFnff7g8us7x-hqFuV3f2SKjKclP_X2FI |
| | | #OSS及短信配置 |
| | | code: |
| | | config: |
| | |
| | | conf: |
| | | appId: wxa17e8d1331e50934 |
| | | secretId: 79c234527fd3b6553679d52be5e29b19 |
| | | appLiveResultTemplateId: 1wheNdyQ88Cz9Z7L1EXxR2L0u4X4LaeXoZVtZwHCagk |
| | | officeAppLiveResultTemplateId: 7w1JVe3S4ClFnff7g8us7x-hqFuV3f2SKjKclP_X2FI |
| | | payment: |
| | | wx: |
| | | # 微信appid |
| | |
| | | * 用户检测缓存 |
| | | */ |
| | | public static final String AI_USER_INSPECTION = "ai_user_inspection:"; |
| | | /** |
| | | * 热门活动点击缓存 |
| | | */ |
| | | public static final String SYS_ACTIVITY_CLICK_COUNT = "sys_activity_click_count:"; |
| | | /** |
| | | * 产品介绍点击缓存 |
| | | */ |
| | | public static final String SYS_EDUCATION_CLICK_COUNT = "sys_education_click_count:"; |
| | | /** |
| | | * 教育咨询点击缓存 |
| | | */ |
| | | public static final String SYS_PRODUCT_CLICK_COUNT = "sys_product_click_count:"; |
| | | /** |
| | | * 直播点击缓存 |
| | | */ |
| | | public static final String SYS_LIVE_COUNT = "sys_live_count:"; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 小程序订阅消息发送地址 |
| | | */ |
| | | public static final String TEMPLATE_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token=ACCESS_TOKEN"; |
| | | /** |
| | | * 模板消息发送地址 |
| | | */ |
| | | public static final String OFFICIAL_ACCOUNT_TEMPLATE_URL = "https://api.weixin.qq.com/cgi-bin/message/template/subscribe?access_token=ACCESS_TOKEN"; |
| | | } |
| | |
| | | @ApiModelProperty(value = "角色类型 1=平台 2=分公司 3=业务员 4=供应商 5=诊所端 6=仓库员") |
| | | @TableField(value = "role_type") |
| | | private Integer roleType; |
| | | |
| | | @ApiModelProperty(value = "微信openid") |
| | | @TableField("open_id") |
| | | private String openId; |
| | | public String getRoleName() { |
| | | return roleName; |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.listener; |
| | | |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.listener.event.PublishTopicLiveInfoEvent; |
| | | import com.ruoyi.system.model.TCrmClinic; |
| | | import com.ruoyi.system.model.TCrmSalesperson; |
| | | import com.ruoyi.system.model.TSysAppUser; |
| | | import com.ruoyi.system.model.TSysLive; |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.utils.util.TemplateMessageSendUtil; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.event.EventListener; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName PublishTopicUpdateCollectEventListener |
| | | * @Description |
| | | * @date 2021-08-11 18:44 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class PublishTopicLiveInfoEventListener { |
| | | |
| | | @Autowired |
| | | private TemplateMessageSendUtil templateMessageSendUtil; |
| | | @Autowired |
| | | private TCrmClinicService crmClinicService; |
| | | @Autowired |
| | | private TSysAppUserService sysAppUserService; |
| | | @Autowired |
| | | private TCrmSalespersonService crmSalespersonService; |
| | | @Autowired |
| | | private TSysLiveService sysLiveService; |
| | | @Autowired |
| | | private ISysUserService sysUserService; |
| | | |
| | | @Async |
| | | @EventListener(PublishTopicLiveInfoEvent.class) |
| | | public void PublishTopicLiveInfoEventListener(PublishTopicLiveInfoEvent event) { |
| | | String pushTypeAndId = (String) event.getSource(); |
| | | String[] split = pushTypeAndId.split("_"); |
| | | String pushType = split[0]; |
| | | String liveId = split[1]; |
| | | try { |
| | | // 查询直播信息 |
| | | TSysLive sysLive = sysLiveService.getById(liveId); |
| | | if(Objects.isNull(sysLive)){ |
| | | log.error("模板消息发送--未查询到直播信息"); |
| | | return; |
| | | } |
| | | String liveTitle = sysLive.getLiveTitle(); |
| | | String liveStartTime = DateUtils.localDateTimeToString(sysLive.getStartTime()); |
| | | log.info("开始发送直播信息"); |
| | | if(pushType.contains("1")){ |
| | | // 诊所 |
| | | List<TCrmClinic> clinicList = crmClinicService.list(); |
| | | if(!CollectionUtils.isEmpty(clinicList)){ |
| | | List<Long> userIds = clinicList.stream().map(TCrmClinic::getUserId).collect(Collectors.toList()); |
| | | List<SysUser> sysUserList = sysUserService.selectUserListByIds(userIds); |
| | | for (SysUser user : sysUserList) { |
| | | templateMessageSendUtil.wxOfficeTemplateAppLiveRequest(user.getOpenId(),liveTitle,liveStartTime); |
| | | } |
| | | } |
| | | } |
| | | if(pushType.contains("2")){ |
| | | // 用户 |
| | | List<TSysAppUser> sysAppUsers = sysAppUserService.list(); |
| | | for (TSysAppUser sysAppUser : sysAppUsers) { |
| | | templateMessageSendUtil.wxOfficeTemplateAppLiveRequest(sysAppUser.getOfficeOpenId(),liveTitle,liveStartTime); |
| | | } |
| | | } |
| | | if(pushType.contains("3")){ |
| | | // 业务员 |
| | | List<TCrmSalesperson> crmSalespeopleList = crmSalespersonService.list(); |
| | | if(!CollectionUtils.isEmpty(crmSalespeopleList)){ |
| | | List<Long> userIds = crmSalespeopleList.stream().map(TCrmSalesperson::getUserId).collect(Collectors.toList()); |
| | | List<SysUser> sysUserList = sysUserService.selectUserListByIds(userIds); |
| | | for (SysUser user : sysUserList) { |
| | | templateMessageSendUtil.wxOfficeTemplateAppLiveRequest(user.getOpenId(),liveTitle,liveStartTime); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("发送直播信息失败:{}", e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.listener.event; |
| | | |
| | | import org.springframework.context.ApplicationEvent; |
| | | |
| | | /** |
| | | * @author xiaochen |
| | | * @ClassName member微信用户信息的注册修改的发布事件 |
| | | * @Description 微信用户信息的注册修改的发布事件 |
| | | * @date 2021-06-24 15:04 |
| | | */ |
| | | public class PublishTopicLiveInfoEvent extends ApplicationEvent { |
| | | |
| | | public PublishTopicLiveInfoEvent(String source) { |
| | | super(source); |
| | | } |
| | | |
| | | } |
| | |
| | | List<SysUser> selectBatchIds(@Param("personIds") List<Integer> personIds); |
| | | |
| | | void updateUserStatusByUserIds(@Param("userIds")List<Long> userIds, @Param("status")String status); |
| | | |
| | | List<SysUser> selectUserListByIds(@Param("userIds")List<Long> userIds); |
| | | } |
| | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TSysActivity; |
| | | import com.ruoyi.system.query.TSysActivityQuery; |
| | | import com.ruoyi.system.vo.TSysActivityVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TSysActivity> pageList(@Param("query") TSysActivityQuery query, @Param("pageInfo")PageInfo<TSysActivity> pageInfo); |
| | | List<TSysActivityVO> pageList(@Param("query") TSysActivityQuery query, @Param("pageInfo")PageInfo<TSysActivityVO> pageInfo); |
| | | /** |
| | | * 分页查询 |
| | | * |
| | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TSysEducationalInfo; |
| | | import com.ruoyi.system.query.TSysEducationalInfoQuery; |
| | | import com.ruoyi.system.vo.TSysEducationalInfoVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TSysEducationalInfo> pageList(@Param("query") TSysEducationalInfoQuery query, @Param("pageInfo")PageInfo<TSysEducationalInfo> pageInfo); |
| | | List<TSysEducationalInfoVO> pageList(@Param("query") TSysEducationalInfoQuery query, @Param("pageInfo")PageInfo<TSysEducationalInfoVO> pageInfo); |
| | | /** |
| | | * 获取教育资讯分页列表 |
| | | * @param query |
| | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TSysProductIntroduction; |
| | | import com.ruoyi.system.query.TSysProductIntroductionQuery; |
| | | import com.ruoyi.system.vo.TSysProductIntroductionVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | |
| | | * @param pageInfo |
| | | * @return |
| | | */ |
| | | List<TSysProductIntroduction> pageList(@Param("query") TSysProductIntroductionQuery query, @Param("pageInfo")PageInfo<TSysProductIntroduction> pageInfo); |
| | | List<TSysProductIntroductionVO> pageList(@Param("query") TSysProductIntroductionQuery query, @Param("pageInfo")PageInfo<TSysProductIntroductionVO> pageInfo); |
| | | /** |
| | | * 分页查询 |
| | | * |
| | |
| | | @TableField("open_id") |
| | | private String openId; |
| | | |
| | | @ApiModelProperty(value = "公众号openId") |
| | | @TableField("office_open_id") |
| | | private String officeOpenId; |
| | | |
| | | @ApiModelProperty(value = "慢性病id,逗号分割") |
| | | @TableField("chronic_disease_id") |
| | | private String chronicDiseaseId; |
| | |
| | | @TableField("push_type") |
| | | private String pushType; |
| | | |
| | | @ApiModelProperty(value = "点击次数") |
| | | @TableField("click_count") |
| | | private Integer clickCount; |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.ruoyi.common.core.domain.BaseModel; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @TableName("t_sys_other_config") |
| | | @ApiModel(value="TSysOtherConfig对象", description="其他设置") |
| | | public class TSysOtherConfig implements Serializable { |
| | | public class TSysOtherConfig extends BaseModel { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | |
| | | private BigDecimal aiPrice; |
| | | |
| | | @ApiModelProperty(value = "自动收货时间") |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
| | | @TableField("delivery_time") |
| | | private LocalDateTime deliveryTime; |
| | | private Integer deliveryTime; |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "角色类型") |
| | | private Integer roleType; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "角色类型") |
| | | private Integer roleType; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "前端忽略") |
| | | private String appUserId; |
| | | |
| | | @ApiModelProperty(value = "角色类型") |
| | | private Integer roleType; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | } |
| | |
| | | |
| | | @ApiModelProperty(value = "角色类型") |
| | | private Integer roleType; |
| | | |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | } |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | |
| | | long selectIdByPhone(String phonenumber); |
| | | |
| | | void updateUserStatusByUserIds(List<Long> userIds, String status); |
| | | |
| | | List<SysUser> selectUserListByIds(List<Long> userIds); |
| | | } |
| | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TSysActivity; |
| | | import com.ruoyi.system.query.TSysActivityQuery; |
| | | import com.ruoyi.system.vo.TSysActivityVO; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TSysActivity> pageList(TSysActivityQuery query); |
| | | PageInfo<TSysActivityVO> pageList(TSysActivityQuery query); |
| | | /** |
| | | * 获取热门活动分页列表 |
| | | * @param query |
| | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TSysEducationalInfo; |
| | | import com.ruoyi.system.query.TSysEducationalInfoQuery; |
| | | import com.ruoyi.system.vo.TSysEducationalInfoVO; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TSysEducationalInfo> pageList(TSysEducationalInfoQuery query); |
| | | PageInfo<TSysEducationalInfoVO> pageList(TSysEducationalInfoQuery query); |
| | | /** |
| | | * 获取教育资讯分页列表 |
| | | * @param query |
| | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.model.TSysProductIntroduction; |
| | | import com.ruoyi.system.query.TSysProductIntroductionQuery; |
| | | import com.ruoyi.system.vo.TSysProductIntroductionVO; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @param query |
| | | * @return |
| | | */ |
| | | PageInfo<TSysProductIntroduction> pageList(TSysProductIntroductionQuery query); |
| | | PageInfo<TSysProductIntroductionVO> pageList(TSysProductIntroductionQuery query); |
| | | /** |
| | | * 获取产品介绍分页列表 |
| | | * @param query |
| | |
| | | userMapper.updateUserStatusByUserIds(userIds, status); |
| | | } |
| | | |
| | | @Override |
| | | public List<SysUser> selectUserListByIds(List<Long> userIds) { |
| | | return userMapper.selectUserListByIds(userIds); |
| | | } |
| | | |
| | | // @Override |
| | | // public UserInfoVo userInfo(Long userId) { |
| | | // return userMapper.userInfo(userId); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.system.mapper.TSysActivityMapper; |
| | | import com.ruoyi.system.model.TSysActivity; |
| | | import com.ruoyi.system.model.TSysEducationalInfo; |
| | | import com.ruoyi.system.query.TSysActivityQuery; |
| | | import com.ruoyi.system.service.TSysActivityService; |
| | | import com.ruoyi.system.vo.TSysActivityVO; |
| | | import com.ruoyi.system.vo.TSysProductIntroductionVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class TSysActivityServiceImpl extends ServiceImpl<TSysActivityMapper, TSysActivity> implements TSysActivityService { |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | @Override |
| | | public PageInfo<TSysActivity> pageList(TSysActivityQuery query) { |
| | | PageInfo<TSysActivity> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TSysActivity> list = this.baseMapper.pageList(query,pageInfo); |
| | | public PageInfo<TSysActivityVO> pageList(TSysActivityQuery query) { |
| | | PageInfo<TSysActivityVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TSysActivityVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | if (CollectionUtils.isEmpty(list)){ |
| | | return pageInfo; |
| | | } |
| | | if(query.getRoleType() == 5){ |
| | | Long userId = query.getUserId(); |
| | | for (TSysActivityVO sysActivityVO : list) { |
| | | Set<Long> cacheSet = redisCache.getCacheSet(Constants.SYS_ACTIVITY_CLICK_COUNT + sysActivityVO.getId()); |
| | | if(cacheSet.contains(userId)){ |
| | | sysActivityVO.setIsView(true); |
| | | } |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.system.model.TErpGoodsType; |
| | | import com.ruoyi.system.model.TSysEducationalInfo; |
| | | import com.ruoyi.system.mapper.TSysEducationalInfoMapper; |
| | | import com.ruoyi.system.query.TSysEducationalInfoQuery; |
| | | import com.ruoyi.system.service.TSysEducationalInfoService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.vo.TSysEducationalInfoVO; |
| | | import com.ruoyi.system.vo.TSysProductIntroductionVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | @Service |
| | | public class TSysEducationalInfoServiceImpl extends ServiceImpl<TSysEducationalInfoMapper, TSysEducationalInfo> implements TSysEducationalInfoService { |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | @Override |
| | | public PageInfo<TSysEducationalInfo> pageList(TSysEducationalInfoQuery query) { |
| | | PageInfo<TSysEducationalInfo> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TSysEducationalInfo> list = this.baseMapper.pageList(query,pageInfo); |
| | | public PageInfo<TSysEducationalInfoVO> pageList(TSysEducationalInfoQuery query) { |
| | | PageInfo<TSysEducationalInfoVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TSysEducationalInfoVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | if (CollectionUtils.isEmpty(list)){ |
| | | return pageInfo; |
| | | } |
| | | if(query.getRoleType() == 5){ |
| | | Long userId = query.getUserId(); |
| | | for (TSysEducationalInfoVO sysEducationalInfoVO : list) { |
| | | Set<Long> cacheSet = redisCache.getCacheSet(Constants.SYS_EDUCATION_CLICK_COUNT + sysEducationalInfoVO.getId()); |
| | | if(cacheSet.contains(userId)){ |
| | | sysEducationalInfoVO.setIsView(true); |
| | | } |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.listener.PublishTopicLiveInfoEventListener; |
| | | import com.ruoyi.system.listener.event.PublishTopicLiveInfoEvent; |
| | | import com.ruoyi.system.mapper.TSysLiveMapper; |
| | | import com.ruoyi.system.model.TSysEducationalInfo; |
| | | import com.ruoyi.system.model.TSysLive; |
| | |
| | | import com.ruoyi.system.task.base.QuartzManager; |
| | | import com.ruoyi.system.task.base.TimeJobType; |
| | | import com.ruoyi.system.task.jobs.LivePushJob; |
| | | import com.ruoyi.system.utils.util.TemplateMessageSendUtil; |
| | | import com.ruoyi.system.vo.TSysActivityVO; |
| | | import com.ruoyi.system.vo.TSysLiveVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @Autowired |
| | | private ApplicationContext applicationContext; |
| | | @Override |
| | | public R pushUser(String id, String pushType) { |
| | | TSysLive sysLive = this.getById(id); |
| | |
| | | } |
| | | sysLive.setPushType(pushType); |
| | | this.updateById(sysLive); |
| | | // 添加定时任务 直播开始推送 |
| | | Map<String, ? extends Object> maps = |
| | | new ImmutableMap.Builder<String, String>(). |
| | | put("id", sysLive.getId()) |
| | | .build(); |
| | | QuartzManager.addJob( |
| | | LivePushJob.class, |
| | | (LivePushJob.name+sysLive.getId()).toUpperCase(), |
| | | TimeJobType.LIVE_PUSH, |
| | | DateUtils.localDateTimeToDate(sysLive.getStartTime()), |
| | | maps |
| | | ); |
| | | // 直播开始推送公众号消息 |
| | | applicationContext.publishEvent(new PublishTopicLiveInfoEvent(pushType+"_"+id)); |
| | | } |
| | | return R.ok(); |
| | | } |
| | |
| | | sysLive.setLiveStatus(3); |
| | | } |
| | | // 查看是否包含该值 |
| | | boolean memberInSet = redisCache.isMemberInSet(Constants.LIVE_APPOINTMENT_PUSH + sysLive.getId(), query.getAppUserId()); |
| | | sysLive.setAppointmentStatus(memberInSet ? 2 : 1); |
| | | // boolean memberInSet = redisCache.isMemberInSet(Constants.LIVE_APPOINTMENT_PUSH + sysLive.getId(), query.getAppUserId()); |
| | | // sysLive.setAppointmentStatus(memberInSet ? 2 : 1); |
| | | |
| | | if(query.getRoleType() == 5){ |
| | | Long userId = query.getUserId(); |
| | | Set<Long> cacheSet = redisCache.getCacheSet(Constants.SYS_ACTIVITY_CLICK_COUNT + sysLive.getId()); |
| | | if(cacheSet.contains(userId)){ |
| | | sysLive.setIsView(true); |
| | | } |
| | | } |
| | | |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.system.mapper.TSysProductIntroductionMapper; |
| | | import com.ruoyi.system.model.TSysEducationalInfo; |
| | | import com.ruoyi.system.model.TSysProductIntroduction; |
| | | import com.ruoyi.system.query.TSysProductIntroductionQuery; |
| | | import com.ruoyi.system.service.TSysProductIntroductionService; |
| | | import com.ruoyi.system.vo.TSysProductIntroductionVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TSysProductIntroductionServiceImpl extends ServiceImpl<TSysProductIntroductionMapper, TSysProductIntroduction> implements TSysProductIntroductionService { |
| | | |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | |
| | | @Override |
| | | public PageInfo<TSysProductIntroduction> pageList(TSysProductIntroductionQuery query) { |
| | | PageInfo<TSysProductIntroduction> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TSysProductIntroduction> list = this.baseMapper.pageList(query,pageInfo); |
| | | public PageInfo<TSysProductIntroductionVO> pageList(TSysProductIntroductionQuery query) { |
| | | PageInfo<TSysProductIntroductionVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TSysProductIntroductionVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | if (CollectionUtils.isEmpty(list)){ |
| | | return pageInfo; |
| | | } |
| | | if(query.getRoleType() == 5){ |
| | | Long userId = query.getUserId(); |
| | | for (TSysProductIntroductionVO tSysProductIntroduction : list) { |
| | | Set<Long> cacheSet = redisCache.getCacheSet(Constants.SYS_PRODUCT_CLICK_COUNT + tSysProductIntroduction.getId()); |
| | | if(cacheSet.contains(userId)){ |
| | | tSysProductIntroduction.setIsView(true); |
| | | } |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | |
| | | |
| | | import com.aizuda.bpm.mybatisplus.mapper.FlwTaskActorMapper; |
| | | import com.aizuda.bpm.mybatisplus.mapper.FlwTaskMapper; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.TSysAppUserService; |
| | | import com.ruoyi.system.service.TSysLiveService; |
| | | import com.ruoyi.system.task.utils.SpringContextsUtil; |
| | | import com.ruoyi.system.utils.util.TemplateMessageSendUtil; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | |
| | | |
| | | protected ISysUserService sysUserService; |
| | | protected TSysLiveService sysLiveService; |
| | | protected RedisCache redisCache; |
| | | protected TSysAppUserService sysAppUserService; |
| | | protected TemplateMessageSendUtil templateMessageSendUtil; |
| | | |
| | | public AbstractJob(){ |
| | | this.sysUserService = SpringContextsUtil.getBean(ISysUserService.class); |
| | | this.sysLiveService = SpringContextsUtil.getBean(TSysLiveService.class); |
| | | this.redisCache = SpringContextsUtil.getBean(RedisCache.class); |
| | | this.sysAppUserService = SpringContextsUtil.getBean(TSysAppUserService.class); |
| | | this.templateMessageSendUtil = SpringContextsUtil.getBean(TemplateMessageSendUtil.class); |
| | | } |
| | | |
| | | |
| | |
| | | package com.ruoyi.system.task.jobs; |
| | | |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.system.model.TSysAppUser; |
| | | import com.ruoyi.system.model.TSysLive; |
| | | import com.ruoyi.system.task.base.AbstractJob; |
| | | import org.quartz.JobDataMap; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Set; |
| | | |
| | | /** |
| | | * 直播推送定时任务 |
| | |
| | | public void execute(JobExecutionContext context) |
| | | throws JobExecutionException { |
| | | JobDataMap maps = context.getMergedJobDataMap(); |
| | | Long liveId = maps.getLong("id"); |
| | | String liveId = maps.getString("id"); |
| | | Set<String> userIds = redisCache.getCacheSet(Constants.LIVE_APPOINTMENT_PUSH + liveId); |
| | | if(CollectionUtils.isEmpty(userIds)){ |
| | | return; |
| | | } |
| | | try { |
| | | System.out.println("开始执行直播推送任务"); |
| | | TSysLive sysLive = sysLiveService.getById(liveId); |
| | | if(Objects.nonNull(sysLive)){ |
| | | String liveTitle = sysLive.getLiveTitle(); |
| | | String startTime = DateUtils.localDateTimeToString(sysLive.getStartTime()); |
| | | List<TSysAppUser> sysAppUsers = sysAppUserService.list(Wrappers.lambdaQuery(TSysAppUser.class) |
| | | .in(TSysAppUser::getId, userIds)); |
| | | for(TSysAppUser sysAppUser : sysAppUsers){ |
| | | templateMessageSendUtil.wxTemplateAppLiveResultRequest(sysAppUser.getOpenId(), liveTitle, startTime); |
| | | } |
| | | } |
| | | }catch(Exception e){ |
| | | e.printStackTrace(); |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.utils.util; |
| | | |
| | | import com.fasterxml.jackson.core.JsonGenerator; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.fasterxml.jackson.databind.DeserializationFeature; |
| | | import com.fasterxml.jackson.databind.JsonSerializer; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.fasterxml.jackson.databind.SerializerProvider; |
| | | import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.system.utils.wx.config.JacksonConfig; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | import java.io.IOException; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * Json转换工具类 |
| | | * 参考:https://blog.csdn.net/weixin_38413579/article/details/82562634 |
| | | * @author madman |
| | | */ |
| | | @Slf4j |
| | | public final class JsonUtils { |
| | | |
| | | private static final ObjectMapper OM = new ObjectMapper(); |
| | | private static final JavaTimeModule timeModule = new JavaTimeModule(); |
| | | |
| | | /** |
| | | * 转换LocalDateTime |
| | | */ |
| | | static class LocalDateTimeSerializer extends JsonSerializer<LocalDateTime> { |
| | | @Override |
| | | public void serialize(LocalDateTime localDateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { |
| | | jsonGenerator.writeString(localDateTime.format(DateTimeFormatter.ofPattern(JacksonConfig.dateTimeFormat))); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 转换LocalDate |
| | | */ |
| | | static class LocalDateSerializer extends JsonSerializer<LocalDate> { |
| | | @Override |
| | | public void serialize(LocalDate localDate, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { |
| | | jsonGenerator.writeString(localDate.format(DateTimeFormatter.ofPattern(JacksonConfig.dateFormat))); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置 ObjectMapper |
| | | * |
| | | * @return |
| | | */ |
| | | private static ObjectMapper getObjectMapper() { |
| | | // 序列化 |
| | | timeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer()); |
| | | timeModule.addSerializer(LocalDate.class, new LocalDateSerializer()); |
| | | // 反序列化 |
| | | timeModule.addDeserializer(LocalDateTime.class, |
| | | new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern(JacksonConfig.dateTimeFormat))); |
| | | timeModule.addDeserializer(LocalDate.class, |
| | | new LocalDateDeserializer(DateTimeFormatter.ofPattern(JacksonConfig.dateFormat))); |
| | | // 允许对象忽略json中不存在的属性 |
| | | OM.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); |
| | | OM.registerModule(timeModule); |
| | | return OM; |
| | | } |
| | | |
| | | /** |
| | | * 将对象序列化 |
| | | */ |
| | | public static <T> String toJsonString(T obj) { |
| | | try { |
| | | ObjectMapper om = getObjectMapper(); |
| | | return om.writeValueAsString(obj); |
| | | } catch (JsonProcessingException e) { |
| | | log.error("转json字符串失败:{}", obj); |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 反序列化对象字符串 |
| | | */ |
| | | public static <T> T parseObject(String json, Class<T> clazz) { |
| | | try { |
| | | ObjectMapper om = getObjectMapper(); |
| | | return om.readValue(json, clazz); |
| | | } catch (JsonProcessingException e) { |
| | | throw new ServiceException("反序列化对象字符串失败"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 反序列化字符串成为对象 |
| | | */ |
| | | public static <T> T parseObject(String json, TypeReference<T> valueTypeRef) { |
| | | try { |
| | | ObjectMapper om = getObjectMapper(); |
| | | return om.readValue(json, valueTypeRef); |
| | | } catch (JsonProcessingException e) { |
| | | throw new ServiceException("反序列化字符串成为对象失败"); |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.utils.util; |
| | | |
| | | |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.redis.RedisCache; |
| | | import com.ruoyi.common.core.utils.HttpUtils; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.system.utils.wx.model.WeixinProperties; |
| | | import com.ruoyi.system.utils.wx.template.Template; |
| | | import com.ruoyi.system.utils.wx.template.wxTemplateAppLiveResult.WxOfficeTemplateAppLiveResultRequest; |
| | | import com.ruoyi.system.utils.wx.template.wxTemplateAppLiveResult.WxOfficeTemplateAppLiveResultRequestData; |
| | | import com.ruoyi.system.utils.wx.template.wxTemplateAppLiveResult.WxTemplateAppLiveResultRequest; |
| | | import com.ruoyi.system.utils.wx.template.wxTemplateAppLiveResult.WxTemplateAppLiveResultRequestData; |
| | | import com.ruoyi.system.utils.wx.tools.WxAppletTools; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * 消息模板发送 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class TemplateMessageSendUtil implements Serializable { |
| | | private final static String ACCESS_TOKEN_CACHE_KEY = "accessToken:"; |
| | | @Autowired |
| | | private RedisCache redisCache; |
| | | @Autowired |
| | | private RestTemplate wxRestTemplate; |
| | | @Autowired |
| | | private WeixinProperties weixinProperties; |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | /** |
| | | * 直播开始小程序订阅通知 |
| | | * @param openId 用户openId |
| | | * @param liveTitle 标题 |
| | | * @param startTime 开始时间 |
| | | */ |
| | | public String wxTemplateAppLiveResultRequest(String openId,String liveTitle,String startTime) { |
| | | WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, weixinProperties, redisService); |
| | | // 1,获取access_token |
| | | String accessToken = redisCache.getCacheObject(ACCESS_TOKEN_CACHE_KEY); |
| | | if (!StringUtils.hasLength(accessToken)) { |
| | | accessToken = appletTools.getAccessToken(); |
| | | } |
| | | try { |
| | | log.info("直播开始提醒通知:------------------------"); |
| | | // 创建请求实体 |
| | | WxTemplateAppLiveResultRequest wxTemplateAppLiveResultRequest = new WxTemplateAppLiveResultRequest(); |
| | | wxTemplateAppLiveResultRequest.setTouser(openId); |
| | | wxTemplateAppLiveResultRequest.setTemplate_id(weixinProperties.getAppLiveResultTemplateId()); |
| | | // 标题 |
| | | Template thing1 = new Template(); |
| | | thing1.setValue(liveTitle); |
| | | // 开始时间 |
| | | Template time2 = new Template(); |
| | | time2.setValue(startTime); |
| | | // 发送模板消息参数实体封装 |
| | | WxTemplateAppLiveResultRequestData wxTemplateAppLiveResultRequestData = new WxTemplateAppLiveResultRequestData(); |
| | | wxTemplateAppLiveResultRequestData.setThing1(thing1); |
| | | wxTemplateAppLiveResultRequestData.setTime2(time2); |
| | | wxTemplateAppLiveResultRequest.setData(wxTemplateAppLiveResultRequestData); |
| | | // 4,发送消息给用户 |
| | | String url = Constants.TEMPLATE_URL.replace("ACCESS_TOKEN", accessToken); |
| | | String result = HttpUtils.sendPost(url, JsonUtils.toJsonString(wxTemplateAppLiveResultRequest)); |
| | | log.info("直播开始通知模板消息返回数据:{}", result); |
| | | return result; |
| | | } catch (Exception e) { |
| | | log.error("直播开始通知失败;"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 微信公众号模板消息发送 |
| | | * @param openId 用户openId |
| | | * @param liveTitle 标题 |
| | | * @param startTime 开始时间 |
| | | */ |
| | | public String wxOfficeTemplateAppLiveRequest(String openId,String liveTitle,String startTime) { |
| | | WxAppletTools appletTools = new WxAppletTools(wxRestTemplate, weixinProperties, redisService); |
| | | // 1,获取access_token |
| | | String accessToken = redisCache.getCacheObject(ACCESS_TOKEN_CACHE_KEY); |
| | | if (!StringUtils.hasLength(accessToken)) { |
| | | accessToken = appletTools.getAccessToken(); |
| | | } |
| | | try { |
| | | log.info("模板消息发送提醒通知:------------------------"); |
| | | // 创建请求实体 |
| | | WxOfficeTemplateAppLiveResultRequest wxOfficeTemplateAppLiveResultRequest = new WxOfficeTemplateAppLiveResultRequest(); |
| | | wxOfficeTemplateAppLiveResultRequest.setTouser(openId); |
| | | wxOfficeTemplateAppLiveResultRequest.setTemplate_id(weixinProperties.getOfficeAppLiveResultTemplateId()); |
| | | // 标题 |
| | | Template thing1 = new Template(); |
| | | thing1.setValue(liveTitle); |
| | | // 开始时间 |
| | | Template time18 = new Template(); |
| | | time18.setValue(startTime); |
| | | // 发送模板消息参数实体封装 |
| | | WxOfficeTemplateAppLiveResultRequestData wxOfficeTemplateAppLiveResultRequestData = new WxOfficeTemplateAppLiveResultRequestData(); |
| | | wxOfficeTemplateAppLiveResultRequestData.setThing1(thing1); |
| | | wxOfficeTemplateAppLiveResultRequestData.setTime18(time18); |
| | | wxOfficeTemplateAppLiveResultRequest.setData(wxOfficeTemplateAppLiveResultRequestData); |
| | | // 4,发送消息给用户 |
| | | String url = Constants.OFFICIAL_ACCOUNT_TEMPLATE_URL.replace("ACCESS_TOKEN", accessToken); |
| | | String result = HttpUtils.sendPost(url, JsonUtils.toJsonString(wxOfficeTemplateAppLiveResultRequest)); |
| | | log.info("模板消息发送通知模板消息返回数据:{}", result); |
| | | return result; |
| | | } catch (Exception e) { |
| | | log.error("模板消息发送通知失败;"); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.utils.wx.config; |
| | | |
| | | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer; |
| | | import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer; |
| | | import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * @author liheng |
| | | * @ClassName LocalDateTimeSerializerConfig |
| | | * @Description |
| | | * @date 2020-09-22 11:22 |
| | | */ |
| | | @Configuration |
| | | public class JacksonConfig { |
| | | public static final String dateFormat = "yyyy-MM-dd"; |
| | | public static final String dateTimeFormat = "yyyy-MM-dd HH:mm:ss"; |
| | | |
| | | @Bean |
| | | public Jackson2ObjectMapperBuilderCustomizer jsonCustomizer() { |
| | | return builder -> { |
| | | // Long型精度丢失问题 |
| | | // builder.serializerByType(Long.TYPE, ToStringSerializer.instance); |
| | | builder.serializerByType(Long.class, ToStringSerializer.instance); |
| | | // 时间格式化 |
| | | builder.simpleDateFormat(dateTimeFormat); |
| | | builder.serializers(new LocalDateSerializer(DateTimeFormatter.ofPattern(dateFormat))); |
| | | builder.serializers(new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(dateTimeFormat))); |
| | | }; |
| | | } |
| | | } |
| | |
| | | * @return secret ID |
| | | */ |
| | | private String secretId; |
| | | /** |
| | | * 获取 appLiveResultTemplateId 小程序订阅消息 |
| | | * |
| | | * @return appLiveResultTemplateId |
| | | */ |
| | | private String appLiveResultTemplateId; |
| | | /** |
| | | * 获取 officeAppLiveResultTemplateId 公众号模板消息 |
| | | * |
| | | * @return officeAppLiveResultTemplateId |
| | | */ |
| | | private String officeAppLiveResultTemplateId; |
| | | |
| | | public String getOfficeAppLiveResultTemplateId() { |
| | | return officeAppLiveResultTemplateId; |
| | | } |
| | | |
| | | public void setOfficeAppLiveResultTemplateId(String officeAppLiveResultTemplateId) { |
| | | this.officeAppLiveResultTemplateId = officeAppLiveResultTemplateId; |
| | | } |
| | | |
| | | public String getAppLiveResultTemplateId() { |
| | | return appLiveResultTemplateId; |
| | | } |
| | | |
| | | public void setAppLiveResultTemplateId(String appLiveResultTemplateId) { |
| | | this.appLiveResultTemplateId = appLiveResultTemplateId; |
| | | } |
| | | |
| | | public String getSecretId() { |
| | | return secretId; |
New file |
| | |
| | | package com.ruoyi.system.utils.wx.template; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * @Description 微信消息模板参数实体 |
| | | * @Author xiaochen |
| | | * @Date 2021/11/8 10:30 |
| | | */ |
| | | @Data |
| | | public class Template implements Serializable{ |
| | | |
| | | @ApiModelProperty(value = "消息内容") |
| | | private String value; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.utils.wx.template.wxTemplateAppLiveResult; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | public class WxOfficeTemplateAppLiveResultRequest implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "用户openid") |
| | | private String touser; |
| | | |
| | | @ApiModelProperty(value = "消息模板id") |
| | | private String template_id; |
| | | |
| | | @ApiModelProperty(value = "订阅场景值") |
| | | private String scene = "1000"; |
| | | |
| | | @ApiModelProperty(value = "订阅通知") |
| | | private String title = "课程预约结果通知"; |
| | | |
| | | @ApiModelProperty(value = "消息模板data数据") |
| | | private WxOfficeTemplateAppLiveResultRequestData data; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.utils.wx.template.wxTemplateAppLiveResult; |
| | | |
| | | import com.ruoyi.system.utils.wx.template.Template; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | public class WxOfficeTemplateAppLiveResultRequestData implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "标题") |
| | | private Template thing1; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | private Template time18; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.utils.wx.template.wxTemplateAppLiveResult; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | public class WxTemplateAppLiveResultRequest implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "用户openid") |
| | | private String touser; |
| | | |
| | | @ApiModelProperty(value = "消息模板id") |
| | | private String template_id; |
| | | |
| | | @ApiModelProperty(value = "消息模板data数据") |
| | | private WxTemplateAppLiveResultRequestData data; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.utils.wx.template.wxTemplateAppLiveResult; |
| | | |
| | | import com.ruoyi.system.utils.wx.template.Template; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | public class WxTemplateAppLiveResultRequestData implements Serializable { |
| | | |
| | | @ApiModelProperty(value = "标题") |
| | | private Template thing1; |
| | | |
| | | @ApiModelProperty(value = "开始时间") |
| | | private Template time2; |
| | | |
| | | } |
| | |
| | | /** |
| | | * 请求参数 |
| | | * 属性 类型 默认值 必填 说明 |
| | | * appid string 是 公众号 appId |
| | | * secret string 是 公众号 appSecret |
| | | * code string 是 登录时获取的 code |
| | | * grant_type string 是 授权类型,此处只需填写 authorization_cod |
| | | * <p> |
| | | * 返回值: |
| | | * <p> |
| | | * 属性 类型 说明 |
| | | * openid string 用户唯一标识 |
| | | * session_key string 会话密钥 |
| | | * unionid string 用户在开放平台的唯一标识符,若当前小程序已绑定到微信开放平台帐号下会返回,详见 UnionID 机制说明。 |
| | | * errcode number 错误码 |
| | | * errmsg string 错误信息 |
| | | */ |
| | | private static final String CODE_2_SESSION_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code"; |
| | | /** |
| | | * 请求参数 |
| | | * 属性 类型 默认值 必填 说明 |
| | | * grant_type string 是 填写 client_credential |
| | | * appid string 是 小程序唯一凭证,即 AppID,可在「微信公众平台 - 设置 - 开发设置」页中获得。(需要已经成为开发者,且帐号没有异常状态) |
| | | * secret string 是 小程序唯一凭证密钥,即 AppSecret,获取方式同 appid |
| | |
| | | } |
| | | |
| | | /** |
| | | * 微信公众号获取openId |
| | | * @param resqBody |
| | | * @return |
| | | */ |
| | | public String getAccessToken(String version) { |
| | | String accessToken = redisService.getCacheObject(ACCESSTOKEN_CACHE_KEY + version); |
| | | public Code2SessionRespBody getOpenIdByCode2session(Code2SessionResqBody resqBody) { |
| | | long start = System.currentTimeMillis(); |
| | | String requestUrl = MessageFormat.format(CODE_2_SESSION_URL, wxConfig.getAppId(), wxConfig.getSecretId(), resqBody.getJsCode()); |
| | | long end = System.currentTimeMillis(); |
| | | log.info("code换取sessionKey时间:{}", (end - start)); |
| | | String respBody = wxRestTemplate.getForEntity(requestUrl, String.class).getBody(); |
| | | end = System.currentTimeMillis(); |
| | | log.info("code换取sessionKey时间:{}", (end - start)); |
| | | log.info("Jscode2session:{}", respBody); |
| | | Code2SessionRespBody code2SessionRespBody = WxJsonUtils.parseObject(respBody, Code2SessionRespBody.class); |
| | | // 判断有误异常 |
| | | if (StringUtils.hasLength(code2SessionRespBody.getErrorMsg())) { |
| | | // 抛出错误 |
| | | throw new WxException(code2SessionRespBody.getErrorCode() + ":" + code2SessionRespBody.getErrorMsg()); |
| | | } |
| | | return code2SessionRespBody; |
| | | } |
| | | |
| | | /** |
| | | * @return |
| | | */ |
| | | public String getAccessToken() { |
| | | String accessToken = redisService.getCacheObject(ACCESSTOKEN_CACHE_KEY); |
| | | if (StringUtils.hasLength(accessToken)) { |
| | | return accessToken; |
| | | } |
| | |
| | | // 抛出错误 |
| | | throw new WxException(accessTokenRespBody.getErrorCode() + ":" + accessTokenRespBody.getErrorMsg()); |
| | | } |
| | | redisService.setCacheObject(ACCESSTOKEN_CACHE_KEY + version, accessTokenRespBody.getAccessToken(), 7200L, TimeUnit.SECONDS); |
| | | redisService.setCacheObject(ACCESSTOKEN_CACHE_KEY, accessTokenRespBody.getAccessToken(), 7200L, TimeUnit.SECONDS); |
| | | return accessTokenRespBody.getAccessToken(); |
| | | } |
| | | |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.system.model.TSysActivity; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "热门活动信息TSysActivityVO") |
| | | public class TSysActivityVO extends TSysActivity { |
| | | |
| | | @ApiModelProperty(value = "当前用户是否查看 true=是") |
| | | private Boolean isView = false; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.system.model.TSysEducationalInfo; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "TSysEducationalInfoVO对象", description = "教育资讯") |
| | | public class TSysEducationalInfoVO extends TSysEducationalInfo { |
| | | |
| | | @ApiModelProperty(value = "当前用户是否查看 true=是") |
| | | private Boolean isView = false; |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value = "预约状态 1=未预约 2=已预约") |
| | | private Integer appointmentStatus; |
| | | |
| | | @ApiModelProperty(value = "当前用户是否查看 true=是") |
| | | private Boolean isView = false; |
| | | |
| | | } |
New file |
| | |
| | | package com.ruoyi.system.vo; |
| | | |
| | | import com.ruoyi.system.model.TSysProductIntroduction; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | @ApiModel(value = "产品介绍视图对象TSysProductIntroductionVO") |
| | | public class TSysProductIntroductionVO extends TSysProductIntroduction { |
| | | |
| | | @ApiModelProperty(value = "当前用户是否查看 true=是") |
| | | private Boolean isView = false; |
| | | |
| | | } |
| | |
| | | <select id="selectIdByPhone" resultType="java.lang.Long"> |
| | | select user_id from sys_user where phonenumber = #{phonenumber} and status = 0 and del_flag = 0 |
| | | </select> |
| | | <select id="selectUserListByIds" resultType="com.ruoyi.common.core.domain.entity.SysUser"> |
| | | select * from sys_user where open_id IS NOT NULL AND user_id in |
| | | <foreach item="userId" collection="userIds" separator="," close=")" open="("> |
| | | #{userId} |
| | | </foreach> |
| | | </select> |
| | | |
| | | <insert id="insertUser" parameterType="com.ruoyi.common.core.domain.entity.SysUser" useGeneratedKeys="true" keyProperty="userId"> |
| | | <insert id="insertUser" parameterType="com.ruoyi.common.core.domain.entity.SysUser" useGeneratedKeys="true" keyProperty="userId"> |
| | | insert into sys_user( |
| | | <if test="userId != null and userId != 0">user_id,</if> |
| | | <if test="deptId != null and deptId != 0">dept_id,</if> |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, activity_name, show_type, activity_introduction, activity_cover, activity_detail, status, sort_by, click_count, create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.model.TSysActivity"> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TSysActivityVO"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_sys_activity |
| | |
| | | <result column="birth_time" property="birthTime" /> |
| | | <result column="sex" property="sex" /> |
| | | <result column="open_id" property="openId" /> |
| | | <result column="office_open_id" property="officeOpenId" /> |
| | | <result column="chronic_disease_id" property="chronicDiseaseId" /> |
| | | <result column="status" property="status" /> |
| | | <result column="last_reminder_time" property="lastReminderTime" /> |
| | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, nick_name, phone, birth_time, sex, open_id,chronic_disease_id,status,last_reminder_time, create_time, update_time, create_by, update_by, disabled |
| | | id, nick_name, phone, birth_time, sex, open_id,chronic_disease_id,status,last_reminder_time,office_open_id, create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TSysAppUserVO"> |
| | | select tsau.id, tsau.nick_name, tsau.phone, tsau.birth_time, tsau.sex, tsau.open_id, |
| | | select tsau.id, tsau.nick_name, tsau.phone, tsau.birth_time, tsau.sex, tsau.open_id,tsau.office_open_id, |
| | | tsau.chronic_disease_id,tsau.status,tsau.last_reminder_time, tsau.create_time, tsau.update_time, tsau.create_by, |
| | | tsau.update_by, tsau.disabled, tsi.lastInspectionTime |
| | | from t_sys_app_user tsau |
| | |
| | | ORDER BY tsau.create_time DESC |
| | | </select> |
| | | <select id="pageChronicDiseaseUserList" resultType="com.ruoyi.system.vo.TSysAppUserVO"> |
| | | select tsau.id, tsau.nick_name, tsau.phone, tsau.birth_time, tsau.sex, tsau.open_id, |
| | | select tsau.id, tsau.nick_name, tsau.phone, tsau.birth_time, tsau.sex, tsau.open_id,tsau.office_open_id, |
| | | tsau.chronic_disease_id,tsau.status,tsau.last_reminder_time, tsau.create_time, tsau.update_time, tsau.create_by, |
| | | tsau.update_by, tsau.disabled |
| | | from t_sys_app_user tsau |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, info_title, show_type, info_cover, info_content, status, sort_by, click_count, create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.model.TSysEducationalInfo"> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TSysEducationalInfoVO"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from t_sys_educational_info |
| | |
| | | <result column="live_url" property="liveUrl" /> |
| | | <result column="live_detail" property="liveDetail" /> |
| | | <result column="push_type" property="pushType" /> |
| | | <result column="click_count" property="clickCount" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="update_time" property="updateTime" /> |
| | | <result column="create_by" property="createBy" /> |
| | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, live_title, live_cover, live_introduction, start_time,end_time, expected_duration, live_way, live_mode,live_url, |
| | | live_lecturer, live_type, password, live_detail, push_type, create_time, update_time, create_by, update_by, disabled |
| | | live_lecturer, live_type, password, live_detail, push_type,click_count, create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TSysLiveVO"> |
| | | SELECT |
| | |
| | | <id column="id" property="id" /> |
| | | <result column="procurement_conditions" property="procurementConditions" /> |
| | | <result column="points_expiration" property="pointsExpiration" /> |
| | | <result column="expira_unit" property="expiraUnit" /> |
| | | <result column="expire_unit" property="expireUnit" /> |
| | | <result column="msg_count" property="msgCount" /> |
| | | <result column="ai_price" property="aiPrice" /> |
| | | <result column="delivery_time" property="deliveryTime" /> |
| | |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, procurement_conditions, points_expiration, expira_unit, msg_count, ai_price, delivery_time, create_time, update_time, create_by, update_by, disabled, create_id |
| | | id, procurement_conditions, points_expiration, expire_unit, msg_count, ai_price, delivery_time, create_time, update_time, create_by, update_by, disabled, create_id |
| | | </sql> |
| | | |
| | | </mapper> |
| | |
| | | <sql id="Base_Column_List"> |
| | | id, product_name, show_type, product_introduction, product_cover, product_detail, status, sort_by, click_count, create_time, update_time, create_by, update_by, disabled |
| | | </sql> |
| | | <select id="pageList" resultType="com.ruoyi.system.model.TSysProductIntroduction"> |
| | | <select id="pageList" resultType="com.ruoyi.system.vo.TSysProductIntroductionVO"> |
| | | SELECT |
| | | <include refid="Base_Column_List"/> |
| | | FROM t_sys_product_introduction |