Commit 02e78257 02e782573ec5a5f411881f73cb8209af4f3fdaab by xianghan

1.忽略member-service.iml文件

1 parent e3c774d0
......@@ -3,7 +3,10 @@ package com.topdraw.business.module.user.iptv.repository;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import java.time.LocalDateTime;
import java.util.Optional;
/**
......@@ -17,4 +20,8 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif
Optional<UserTv> findByPriorityMemberCode(String memberCode);
Optional<UserTv> findByMemberId(Long memberId);
@Modifying
@Query(value = "UPDATE `uc_user_tv` SET `vis_user_id` = ?2, `update_time` = ?3 WHERE `id` = ?1", nativeQuery = true)
Integer updateUserTvVisUserId(Long id, Long visUserId, LocalDateTime now);
}
......
package com.topdraw.business.module.user.iptv.rest;
import com.topdraw.annotation.AnonymousAccess;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.business.module.user.iptv.service.UserTvService;
import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
import com.topdraw.business.module.user.weixin.domain.UserWeixin;
import com.topdraw.business.module.user.weixin.service.UserWeixinService;
import com.topdraw.common.ResultInfo;
import com.topdraw.exception.BadRequestException;
import com.topdraw.exception.GlobeExceptionMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* @author XiangHan
* @date 2021-12-16
*/
@Api(tags = "微信管理")
@RestController
@RequestMapping("/uce/userTv")
@Slf4j
public class UserTvController {
@Autowired
private UserTvService userTvService;
@PostMapping(value = "/updateUserTvVisUserId")
@ApiOperation("新增UserWeixin")
@AnonymousAccess
public ResultInfo updateUserTvVisUserId(@Validated @RequestBody UserTv resources) {
log.info("UserOperationController ==> updateUserTvVisUserId ==>> param ==> {}",resources);
if (StringUtils.isBlank(resources.getPlatformAccount())){
throw new BadRequestException(GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL);
}
if (Objects.isNull(resources.getVisUserId())){
throw new BadRequestException(GlobeExceptionMsg.VIS_USER_ID_IS_NULL);
}
UserTvDTO userTvDTO = this.userTvService.updateUserTvVisUserId(resources);
if (Objects.nonNull(userTvDTO.getId()))
return ResultInfo.success(userTvDTO);
else return ResultInfo.failure("操作失败,请检查 ==>> /uce/userTv/updateUserTvVisUserId");
}
}
......@@ -77,4 +77,11 @@ public interface UserTvService {
* @return
*/
MemberDTO findMemberByPlatformAccount(String platformAccount);
/**
*
* @param resources
* @return
*/
UserTvDTO updateUserTvVisUserId(UserTv resources);
}
......
package com.topdraw.business.module.user.iptv.service.impl;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.business.module.member.service.MemberService;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.user.iptv.domain.UserTv;
import com.topdraw.business.process.service.impl.UserOperationServiceImpl;
import com.topdraw.exception.EntityNotFoundException;
import com.topdraw.exception.GlobeExceptionMsg;
import com.topdraw.utils.ValidationUtil;
......@@ -11,6 +13,7 @@ import com.topdraw.business.module.user.iptv.service.UserTvService;
import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
import com.topdraw.business.module.user.iptv.service.mapper.UserTvMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
......@@ -18,6 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.util.Assert;
import java.time.LocalDateTime;
import java.util.Objects;
import java.util.Optional;
......@@ -37,6 +41,9 @@ public class UserTvServiceImpl implements UserTvService {
@Autowired
private UserTvRepository userTvRepository;
@AsyncMqSend
public void asyncUpdateUserTvVisUserId(UserTvDTO userTvDTO) {}
/**
* 获取大屏账户对应的会员
* <Waring>
......@@ -64,6 +71,30 @@ public class UserTvServiceImpl implements UserTvService {
throw new EntityNotFoundException(UserTvDTO.class,"platformAccount", GlobeExceptionMsg.IPTV_IS_NULL);
}
@Override
@Transactional(rollbackFor = Exception.class)
public UserTvDTO updateUserTvVisUserId(UserTv resources) {
String platformAccount = resources.getPlatformAccount();
UserTvDTO userTvDTO = this.findByPlatformAccount(platformAccount);
if (Objects.nonNull(userTvDTO.getId())) {
Integer integer = this.userTvRepository.updateUserTvVisUserId(userTvDTO.getId(), resources.getVisUserId(), LocalDateTime.now());
if (integer == 1) {
((UserTvServiceImpl) AopContext.currentProxy()).asyncUpdateUserTvVisUserId(userTvDTO);
}
return this.findById(userTvDTO.getId());
}
return null;
}
private MemberDTO findMemberByMemberCode(String memberCode) {
return this.memberService.findByCode(memberCode);
}
......
......@@ -173,4 +173,11 @@ public interface UserOperationService {
* @return
*/
UserTvDTO updateUserTv(UserTv resources);
/**
* 修改大屏账号vis_user_id
* @param resources
* @return
*/
UserTvDTO updateUserTvVisUserId(UserTv resources);
}
......
......@@ -1549,12 +1549,32 @@ public class UserOperationServiceImpl implements UserOperationService {
@Override
public UserTvDTO updateUserTv(UserTv resources) {
UserTvDTO userTvDTO = this.userTvService.update(resources);
Long memberId = userTvDTO.getMemberId();
if (Objects.nonNull(memberId)) {
MemberDTO memberDTO = this.memberService.findById(memberId);
resources.setMemberCode(memberDTO.getCode());
}
// 同步至iptv
((UserOperationServiceImpl)AopContext.currentProxy()).asyncUserTv(userTvDTO);
return userTvDTO;
}
@Override
public UserTvDTO updateUserTvVisUserId(UserTv resources) {
UserTvDTO userTvDTO = this.userTvService.update(resources);
Long memberId = userTvDTO.getMemberId();
if (Objects.nonNull(memberId)) {
MemberDTO memberDTO = this.memberService.findById(memberId);
resources.setMemberCode(memberDTO.getCode());
}
// 同步至iptv
((UserOperationServiceImpl)AopContext.currentProxy()).asyncUserTv(userTvDTO);
return userTvDTO;
......
......@@ -45,7 +45,7 @@ spring:
hibernate:
# 生产环境设置成 none,避免程序运行时自动更新数据库结构
ddl-auto: none
show-sql: false
show-sql: true
servlet:
multipart:
file-size-threshold: 2KB
......
......@@ -64,7 +64,7 @@
<!--监控sql日志输出 -->
<logger name="jdbc.sqlonly" level="OFF" additivity="false">
<logger name="jdbc.sqlonly" level="INFO" additivity="false">
<appender-ref ref="console" />
<appender-ref ref="info" />
</logger>
......