1.修改app登录时app账号和第三方账号同时存在时头像和昵称无法同步的问题
Showing
27 changed files
with
681 additions
and
11 deletions
| ... | @@ -3,6 +3,7 @@ package com.topdraw.business.module.member.address.repository; | ... | @@ -3,6 +3,7 @@ package com.topdraw.business.module.member.address.repository; |
| 3 | import com.topdraw.business.module.member.address.domain.MemberAddress; | 3 | import com.topdraw.business.module.member.address.domain.MemberAddress; |
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | 4 | import org.springframework.data.jpa.repository.JpaRepository; |
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| 6 | import org.springframework.data.jpa.repository.Modifying; | ||
| 6 | import org.springframework.data.jpa.repository.Query; | 7 | import org.springframework.data.jpa.repository.Query; |
| 7 | 8 | ||
| 8 | /** | 9 | /** |
| ... | @@ -14,4 +15,12 @@ public interface MemberAddressRepository extends JpaRepository<MemberAddress, Lo | ... | @@ -14,4 +15,12 @@ public interface MemberAddressRepository extends JpaRepository<MemberAddress, Lo |
| 14 | @Query(value = "select IFNULL(max(sequence),0) from uc_member_address where member_id = ?1" , nativeQuery = true) | 15 | @Query(value = "select IFNULL(max(sequence),0) from uc_member_address where member_id = ?1" , nativeQuery = true) |
| 15 | int findMaxSequenceByMemberId(Long memberId); | 16 | int findMaxSequenceByMemberId(Long memberId); |
| 16 | 17 | ||
| 18 | @Modifying | ||
| 19 | @Query(value = "UPDATE `uc_member_address` SET `is_default` = 1, `update_time` = now() WHERE `id` = ?1", nativeQuery = true) | ||
| 20 | Integer updateDefaultMemberAddressById(Long id); | ||
| 21 | |||
| 22 | @Modifying | ||
| 23 | @Query(value = "UPDATE `uc_member_address` SET `is_default` = 0, `update_time` = now() WHERE `member_id` = ?1", nativeQuery = true) | ||
| 24 | Integer updateUnDefaultMemberAddressByMemberId(Long memberId); | ||
| 25 | |||
| 17 | } | 26 | } | ... | ... |
| ... | @@ -40,4 +40,8 @@ public interface MemberAddressService { | ... | @@ -40,4 +40,8 @@ public interface MemberAddressService { |
| 40 | * @return | 40 | * @return |
| 41 | */ | 41 | */ |
| 42 | int findMaxSequenceByMemberId(Long memberId); | 42 | int findMaxSequenceByMemberId(Long memberId); |
| 43 | |||
| 44 | Integer updateDefaultMemberAddressById(Long id); | ||
| 45 | |||
| 46 | Integer updateUnDefaultMemberAddressByMemberId(Long memberId); | ||
| 43 | } | 47 | } | ... | ... |
| ... | @@ -105,6 +105,18 @@ public class MemberAddressServiceImpl implements MemberAddressService { | ... | @@ -105,6 +105,18 @@ public class MemberAddressServiceImpl implements MemberAddressService { |
| 105 | return this.memberAddressRepository.findMaxSequenceByMemberId(memberId); | 105 | return this.memberAddressRepository.findMaxSequenceByMemberId(memberId); |
| 106 | } | 106 | } |
| 107 | 107 | ||
| 108 | @Override | ||
| 109 | @Transactional(rollbackFor = Exception.class) | ||
| 110 | public Integer updateDefaultMemberAddressById(Long id) { | ||
| 111 | return this.memberAddressRepository.updateDefaultMemberAddressById(id); | ||
| 112 | } | ||
| 113 | |||
| 114 | @Override | ||
| 115 | @Transactional(rollbackFor = Exception.class) | ||
| 116 | public Integer updateUnDefaultMemberAddressByMemberId(Long memberId) { | ||
| 117 | return this.memberAddressRepository.updateUnDefaultMemberAddressByMemberId(memberId); | ||
| 118 | } | ||
| 119 | |||
| 108 | /** | 120 | /** |
| 109 | * 检查会员 | 121 | * 检查会员 |
| 110 | * @param memberAddress | 122 | * @param memberAddress | ... | ... |
| ... | @@ -30,6 +30,7 @@ public class UserAppBuilder { | ... | @@ -30,6 +30,7 @@ public class UserAppBuilder { |
| 30 | userApp.setEmail(resource.getEmail()); | 30 | userApp.setEmail(resource.getEmail()); |
| 31 | userApp.setType(Objects.isNull(resource.getType()) ? resource.getType() : -1); | 31 | userApp.setType(Objects.isNull(resource.getType()) ? resource.getType() : -1); |
| 32 | userApp.setNickname(StringUtils.isNotBlank(resource.getNickname()) ? resource.getNickname() : resource.getUsername()); | 32 | userApp.setNickname(StringUtils.isNotBlank(resource.getNickname()) ? resource.getNickname() : resource.getUsername()); |
| 33 | userApp.setHeadimgurl(resource.getHeadimgurl()); | ||
| 33 | userApp.setPassword(resource.getPassword()); | 34 | userApp.setPassword(resource.getPassword()); |
| 34 | userApp.setCellphone(StringUtils.isNotBlank(resource.getCellphone()) ? resource.getCellphone() : resource.getUsername()); | 35 | userApp.setCellphone(StringUtils.isNotBlank(resource.getCellphone()) ? resource.getCellphone() : resource.getUsername()); |
| 35 | userApp.setBirthday(StringUtils.isNotBlank(resource.getBirthday()) ? resource.getBirthday() : "1900-01-01"); | 36 | userApp.setBirthday(StringUtils.isNotBlank(resource.getBirthday()) ? resource.getBirthday() : "1900-01-01"); | ... | ... |
| ... | @@ -8,6 +8,7 @@ import org.springframework.data.jpa.repository.Query; | ... | @@ -8,6 +8,7 @@ import org.springframework.data.jpa.repository.Query; |
| 8 | import org.springframework.data.repository.query.Param; | 8 | import org.springframework.data.repository.query.Param; |
| 9 | import org.springframework.transaction.annotation.Transactional; | 9 | import org.springframework.transaction.annotation.Transactional; |
| 10 | 10 | ||
| 11 | import java.util.List; | ||
| 11 | import java.util.Optional; | 12 | import java.util.Optional; |
| 12 | 13 | ||
| 13 | /** | 14 | /** |
| ... | @@ -52,5 +53,11 @@ public interface UserAppBindRepository extends JpaRepository<UserAppBind, Long>, | ... | @@ -52,5 +53,11 @@ public interface UserAppBindRepository extends JpaRepository<UserAppBind, Long>, |
| 52 | @Query(value = "UPDATE `uc_user_app_bind` SET `update_time` = now(), `nickname` = :#{#resources.nickname}, `status` = 1, `user_app_id` = :#{#resources.userAppId} " + | 53 | @Query(value = "UPDATE `uc_user_app_bind` SET `update_time` = now(), `nickname` = :#{#resources.nickname}, `status` = 1, `user_app_id` = :#{#resources.userAppId} " + |
| 53 | " WHERE `account` = :#{#resources.account} AND `account_type` = :#{#resources.accountType}", nativeQuery = true) | 54 | " WHERE `account` = :#{#resources.account} AND `account_type` = :#{#resources.accountType}", nativeQuery = true) |
| 54 | Integer updateValidStatusAndUserAppIdAndNickname(@Param("resources") UserAppBind resources); | 55 | Integer updateValidStatusAndUserAppIdAndNickname(@Param("resources") UserAppBind resources); |
| 56 | |||
| 57 | @Modifying | ||
| 58 | @Query(value = "UPDATE `uc_user_app_bind` SET `update_time` = now(), `status` = 0 WHERE `id` IN ?1", nativeQuery = true) | ||
| 59 | Integer appCancellation(List<Long> ids); | ||
| 60 | |||
| 61 | List<UserAppBind> findByUserAppId(Long id); | ||
| 55 | } | 62 | } |
| 56 | 63 | ... | ... |
| ... | @@ -15,16 +15,17 @@ import java.util.Optional; | ... | @@ -15,16 +15,17 @@ import java.util.Optional; |
| 15 | */ | 15 | */ |
| 16 | public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpecificationExecutor<UserApp> { | 16 | public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpecificationExecutor<UserApp> { |
| 17 | 17 | ||
| 18 | @Query(value = "SELECT ua.* FROM uc_user_app ua WHERE ua.`username` = ?1 and ua.`status` IN (0 , 1)", nativeQuery = true) | ||
| 18 | Optional<UserApp> findByUsername(String username); | 19 | Optional<UserApp> findByUsername(String username); |
| 19 | 20 | ||
| 20 | Optional<UserApp> findByUsernameAndPassword(String username, String password); | 21 | Optional<UserApp> findByUsernameAndPassword(String username, String password); |
| 21 | 22 | ||
| 22 | @Modifying | 23 | @Modifying |
| 23 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `last_active_time` = now() WHERE `username` = ?1", nativeQuery = true) | 24 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `last_active_time` = now() WHERE `username` = ?1 AND `status` = 1 ", nativeQuery = true) |
| 24 | Integer updateLastActiveTime(String username); | 25 | Integer updateLastActiveTime(String username); |
| 25 | 26 | ||
| 26 | @Modifying | 27 | @Modifying |
| 27 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `password` = ?2 WHERE `username` = ?1", nativeQuery = true) | 28 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `password` = ?2 WHERE `username` = ?1 AND `status` = 1", nativeQuery = true) |
| 28 | Integer updatePasswordByUsername(String username, String password); | 29 | Integer updatePasswordByUsername(String username, String password); |
| 29 | 30 | ||
| 30 | @Modifying | 31 | @Modifying |
| ... | @@ -38,4 +39,12 @@ public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpec | ... | @@ -38,4 +39,12 @@ public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpec |
| 38 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `password` = ?2 WHERE `id` = ?1", nativeQuery = true) | 39 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `password` = ?2 WHERE `id` = ?1", nativeQuery = true) |
| 39 | Integer updatePasswordById(Long id, String password); | 40 | Integer updatePasswordById(Long id, String password); |
| 40 | 41 | ||
| 42 | @Modifying | ||
| 43 | @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `status` = -1 WHERE `id` = ?1", nativeQuery = true) | ||
| 44 | Integer appCancellation(Long id); | ||
| 45 | |||
| 46 | @Modifying | ||
| 47 | @Query(value = "UPDATE `uc_user_app` SET `last_active_time` = now(), `nickname` = ?2, `headimgurl` = ?3 " + | ||
| 48 | " WHERE `username` = ?1 and `status` = 1 ", nativeQuery = true) | ||
| 49 | Integer updateAppLastActiveTimeAndNicknameAndHeadImg(String username, String nickname, String headimgurl); | ||
| 41 | } | 50 | } | ... | ... |
| ... | @@ -36,6 +36,22 @@ public class UserAppController { | ... | @@ -36,6 +36,22 @@ public class UserAppController { |
| 36 | private UserAppBindService userAppBindService; | 36 | private UserAppBindService userAppBindService; |
| 37 | 37 | ||
| 38 | @Log | 38 | @Log |
| 39 | @PostMapping(value = "/updateAppLastActiveTimeAndNicknameAndHeadImg") | ||
| 40 | @ApiOperation("修改app账号最后登录时间、昵称和头像") | ||
| 41 | @AnonymousAccess | ||
| 42 | public ResultInfo updateAppLastActiveTimeAndNicknameAndHeadImg(@Validated @RequestBody UserApp resources) { | ||
| 43 | log.info("修改app账号密码,参数 ==>> [updatePassword#{}]", resources); | ||
| 44 | String username = resources.getUsername(); | ||
| 45 | if (StringUtils.isBlank(username)) { | ||
| 46 | log.error("修改app账号密码,参数错误,app账号不得为空,[updateLastActiveTime#{}]", resources); | ||
| 47 | return ResultInfo.failure("修改app账号密码失败,参数错误,app账号不得为空"); | ||
| 48 | } | ||
| 49 | |||
| 50 | boolean result = this.userAppService.updateAppLastActiveTimeAndNicknameAndHeadImg(resources); | ||
| 51 | return ResultInfo.success(result); | ||
| 52 | } | ||
| 53 | |||
| 54 | @Log | ||
| 39 | @PostMapping(value = "/updateAppPasswordByUsername") | 55 | @PostMapping(value = "/updateAppPasswordByUsername") |
| 40 | @ApiOperation("修改app账号密码") | 56 | @ApiOperation("修改app账号密码") |
| 41 | @AnonymousAccess | 57 | @AnonymousAccess |
| ... | @@ -53,11 +69,11 @@ public class UserAppController { | ... | @@ -53,11 +69,11 @@ public class UserAppController { |
| 53 | return ResultInfo.failure("修改app账号最新登录时间失败,参数错误,app账号不得为空"); | 69 | return ResultInfo.failure("修改app账号最新登录时间失败,参数错误,app账号不得为空"); |
| 54 | } | 70 | } |
| 55 | 71 | ||
| 56 | boolean passwordRegexResult = RegexUtil.appPasswordRegex(password); | 72 | // boolean passwordRegexResult = RegexUtil.appPasswordRegex(password); |
| 57 | if (!passwordRegexResult) { | 73 | // if (!passwordRegexResult) { |
| 58 | log.error("修改app账号密码失败,参数错误,密码格式不正确,[updatePassword#{}]", resources); | 74 | // log.error("修改app账号密码失败,参数错误,密码格式不正确,[updatePassword#{}]", resources); |
| 59 | return ResultInfo.failure("密码必须包含大小写字母和数字的组合,不能使用特殊字符,长度在 8-25 之间"); | 75 | // return ResultInfo.failure("密码必须包含大小写字母和数字的组合,不能使用特殊字符,长度在 8-25 之间"); |
| 60 | } | 76 | // } |
| 61 | 77 | ||
| 62 | boolean result = this.userAppService.updatePasswordByUsername(resources); | 78 | boolean result = this.userAppService.updatePasswordByUsername(resources); |
| 63 | return ResultInfo.success(result); | 79 | return ResultInfo.success(result); | ... | ... |
| ... | @@ -3,6 +3,8 @@ package com.topdraw.business.module.user.app.service; | ... | @@ -3,6 +3,8 @@ package com.topdraw.business.module.user.app.service; |
| 3 | import com.topdraw.business.module.user.app.domain.UserAppBind; | 3 | import com.topdraw.business.module.user.app.domain.UserAppBind; |
| 4 | import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO; | 4 | import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO; |
| 5 | 5 | ||
| 6 | import java.util.List; | ||
| 7 | |||
| 6 | /** | 8 | /** |
| 7 | * @author XiangHan | 9 | * @author XiangHan |
| 8 | * @date 2022-06-27 | 10 | * @date 2022-06-27 |
| ... | @@ -76,4 +78,8 @@ public interface UserAppBindService { | ... | @@ -76,4 +78,8 @@ public interface UserAppBindService { |
| 76 | * @return | 78 | * @return |
| 77 | */ | 79 | */ |
| 78 | boolean updateValidStatusAndUserAppIdAndNickname(UserAppBind resources); | 80 | boolean updateValidStatusAndUserAppIdAndNickname(UserAppBind resources); |
| 81 | |||
| 82 | boolean appCancellation(List<Long> ids); | ||
| 83 | |||
| 84 | List<UserAppBindDTO> findByUserAppId(Long id); | ||
| 79 | } | 85 | } | ... | ... |
| ... | @@ -73,5 +73,8 @@ public interface UserAppService { | ... | @@ -73,5 +73,8 @@ public interface UserAppService { |
| 73 | UserAppSimpleDTO updateAppInfo(UserApp resources); | 73 | UserAppSimpleDTO updateAppInfo(UserApp resources); |
| 74 | 74 | ||
| 75 | 75 | ||
| 76 | boolean appCancellation(Long id); | ||
| 76 | 77 | ||
| 78 | |||
| 79 | boolean updateAppLastActiveTimeAndNicknameAndHeadImg(UserApp resources); | ||
| 77 | } | 80 | } | ... | ... |
| ... | @@ -13,6 +13,8 @@ import org.springframework.transaction.annotation.Transactional; | ... | @@ -13,6 +13,8 @@ import org.springframework.transaction.annotation.Transactional; |
| 13 | import org.springframework.dao.EmptyResultDataAccessException; | 13 | import org.springframework.dao.EmptyResultDataAccessException; |
| 14 | import org.springframework.util.Assert; | 14 | import org.springframework.util.Assert; |
| 15 | 15 | ||
| 16 | import java.util.List; | ||
| 17 | |||
| 16 | /** | 18 | /** |
| 17 | * @author XiangHan | 19 | * @author XiangHan |
| 18 | * @date 2022-06-27 | 20 | * @date 2022-06-27 |
| ... | @@ -96,5 +98,18 @@ public class UserAppBindServiceImpl implements UserAppBindService { | ... | @@ -96,5 +98,18 @@ public class UserAppBindServiceImpl implements UserAppBindService { |
| 96 | return this.userAppBindRepository.updateValidStatusAndUserAppIdAndNickname(resources) > 0; | 98 | return this.userAppBindRepository.updateValidStatusAndUserAppIdAndNickname(resources) > 0; |
| 97 | } | 99 | } |
| 98 | 100 | ||
| 101 | @Override | ||
| 102 | @Transactional(rollbackFor = Exception.class) | ||
| 103 | public boolean appCancellation(List<Long> ids) { | ||
| 104 | return this.userAppBindRepository.appCancellation(ids) > 0; | ||
| 105 | } | ||
| 106 | |||
| 107 | @Override | ||
| 108 | @Transactional(readOnly = true) | ||
| 109 | public List<UserAppBindDTO> findByUserAppId(Long id) { | ||
| 110 | List<UserAppBind> userAppBinds = this.userAppBindRepository.findByUserAppId(id); | ||
| 111 | return this.userAppBindMapper.toDto(userAppBinds); | ||
| 112 | } | ||
| 113 | |||
| 99 | 114 | ||
| 100 | } | 115 | } | ... | ... |
| ... | @@ -124,6 +124,19 @@ public class UserAppServiceImpl implements UserAppService { | ... | @@ -124,6 +124,19 @@ public class UserAppServiceImpl implements UserAppService { |
| 124 | 124 | ||
| 125 | @Override | 125 | @Override |
| 126 | @Transactional(rollbackFor = Exception.class) | 126 | @Transactional(rollbackFor = Exception.class) |
| 127 | public boolean appCancellation(Long id) { | ||
| 128 | return this.userAppRepository.appCancellation(id) > 0; | ||
| 129 | } | ||
| 130 | |||
| 131 | @Override | ||
| 132 | @Transactional(rollbackFor = Exception.class) | ||
| 133 | public boolean updateAppLastActiveTimeAndNicknameAndHeadImg(UserApp resources) { | ||
| 134 | return this.userAppRepository.updateAppLastActiveTimeAndNicknameAndHeadImg(resources.getUsername(), | ||
| 135 | resources.getNickname(), resources.getHeadimgurl()) > 0; | ||
| 136 | } | ||
| 137 | |||
| 138 | @Override | ||
| 139 | @Transactional(rollbackFor = Exception.class) | ||
| 127 | public boolean updatePasswordById(UserApp resources) { | 140 | public boolean updatePasswordById(UserApp resources) { |
| 128 | return this.userAppRepository.updatePasswordById(resources.getId(), resources.getPassword()) > 0; | 141 | return this.userAppRepository.updatePasswordById(resources.getId(), resources.getPassword()) > 0; |
| 129 | } | 142 | } | ... | ... |
| 1 | package com.topdraw.business.module.user.iptv.growreport.domain; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | import lombok.experimental.Accessors; | ||
| 5 | import cn.hutool.core.bean.BeanUtil; | ||
| 6 | import cn.hutool.core.bean.copier.CopyOptions; | ||
| 7 | import javax.persistence.*; | ||
| 8 | import org.springframework.data.annotation.CreatedDate; | ||
| 9 | import org.springframework.data.annotation.LastModifiedDate; | ||
| 10 | import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
| 11 | import java.sql.Timestamp; | ||
| 12 | |||
| 13 | import java.io.Serializable; | ||
| 14 | |||
| 15 | /** | ||
| 16 | * @author XiangHan | ||
| 17 | * @date 2022-07-07 | ||
| 18 | */ | ||
| 19 | @Entity | ||
| 20 | @Data | ||
| 21 | @EntityListeners(AuditingEntityListener.class) | ||
| 22 | @Accessors(chain = true) | ||
| 23 | @Table(name="uc_growth_report") | ||
| 24 | public class GrowthReport implements Serializable { | ||
| 25 | |||
| 26 | @Id | ||
| 27 | @Column(name = "id") | ||
| 28 | private Long id; | ||
| 29 | |||
| 30 | // 用户id | ||
| 31 | @Column(name = "user_id") | ||
| 32 | private Long userId; | ||
| 33 | |||
| 34 | // 会员id | ||
| 35 | @Column(name = "member_id") | ||
| 36 | private Long memberId; | ||
| 37 | |||
| 38 | // 会员code | ||
| 39 | @Column(name = "member_code") | ||
| 40 | private String memberCode; | ||
| 41 | |||
| 42 | // 大屏账号 | ||
| 43 | @Column(name = "platform_account") | ||
| 44 | private String platformAccount; | ||
| 45 | |||
| 46 | // 开始日期 | ||
| 47 | @Column(name = "start_date") | ||
| 48 | private String startDate; | ||
| 49 | |||
| 50 | // 结束时间 | ||
| 51 | @Column(name = "end_date") | ||
| 52 | private String endDate; | ||
| 53 | |||
| 54 | // 栏目播放时长数据 | ||
| 55 | @Column(name = "data") | ||
| 56 | private String data; | ||
| 57 | |||
| 58 | // 创建时间 | ||
| 59 | @CreatedDate | ||
| 60 | @Column(name = "create_time") | ||
| 61 | private Timestamp createTime; | ||
| 62 | |||
| 63 | // 修改时间 | ||
| 64 | @LastModifiedDate | ||
| 65 | @Column(name = "update_time") | ||
| 66 | private Timestamp updateTime; | ||
| 67 | |||
| 68 | public void copy(GrowthReport source){ | ||
| 69 | BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); | ||
| 70 | } | ||
| 71 | } |
| 1 | package com.topdraw.business.module.user.iptv.growreport.repository; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | import org.springframework.data.jpa.repository.Modifying; | ||
| 7 | import org.springframework.data.jpa.repository.Query; | ||
| 8 | |||
| 9 | import java.util.Optional; | ||
| 10 | |||
| 11 | /** | ||
| 12 | * @author XiangHan | ||
| 13 | * @date 2022-07-07 | ||
| 14 | */ | ||
| 15 | public interface GrowthReportRepository extends JpaRepository<GrowthReport, Long>, JpaSpecificationExecutor<GrowthReport> { | ||
| 16 | |||
| 17 | |||
| 18 | Optional<GrowthReport> findByPlatformAccountAndStartDateAndEndDate(String platformAccount, String weekFirstDay, String weekLastDay); | ||
| 19 | |||
| 20 | |||
| 21 | @Modifying | ||
| 22 | @Query(value = "UPDATE `uc_growth_report` SET `data` = ?2, `update_time` = now() WHERE `id` =?1", nativeQuery = true) | ||
| 23 | Integer updateGrowthReportData(Long id, String data); | ||
| 24 | |||
| 25 | } |
| 1 | package com.topdraw.business.module.user.iptv.growreport.rest; | ||
| 2 | |||
| 3 | import com.topdraw.common.ResultInfo; | ||
| 4 | import com.topdraw.annotation.Log; | ||
| 5 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
| 6 | import com.topdraw.business.module.user.iptv.growreport.service.GrowthReportService; | ||
| 7 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 8 | import org.springframework.data.domain.Pageable; | ||
| 9 | import org.springframework.validation.annotation.Validated; | ||
| 10 | import org.springframework.web.bind.annotation.*; | ||
| 11 | import io.swagger.annotations.*; | ||
| 12 | |||
| 13 | /** | ||
| 14 | * @author XiangHan | ||
| 15 | * @date 2022-07-07 | ||
| 16 | */ | ||
| 17 | @Api(tags = "GrowthReport管理") | ||
| 18 | @RestController | ||
| 19 | @RequestMapping("/api/GrowthReport") | ||
| 20 | public class GrowthReportController { | ||
| 21 | |||
| 22 | @Autowired | ||
| 23 | private GrowthReportService GrowthReportService; | ||
| 24 | |||
| 25 | @Log | ||
| 26 | @PostMapping | ||
| 27 | @ApiOperation("新增GrowthReport") | ||
| 28 | public ResultInfo create(@Validated @RequestBody GrowthReport resources) { | ||
| 29 | GrowthReportService.create(resources); | ||
| 30 | return ResultInfo.success(); | ||
| 31 | } | ||
| 32 | |||
| 33 | @Log | ||
| 34 | @PutMapping | ||
| 35 | @ApiOperation("修改GrowthReport") | ||
| 36 | public ResultInfo update(@Validated @RequestBody GrowthReport resources) { | ||
| 37 | GrowthReportService.update(resources); | ||
| 38 | return ResultInfo.success(); | ||
| 39 | } | ||
| 40 | |||
| 41 | |||
| 42 | @Log | ||
| 43 | @DeleteMapping(value = "/{id}") | ||
| 44 | @ApiOperation("删除GrowthReport") | ||
| 45 | public ResultInfo delete(@PathVariable Long id) { | ||
| 46 | GrowthReportService.delete(id); | ||
| 47 | return ResultInfo.success(); | ||
| 48 | } | ||
| 49 | |||
| 50 | } |
| 1 | package com.topdraw.business.module.user.iptv.growreport.service; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
| 4 | import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO; | ||
| 5 | |||
| 6 | /** | ||
| 7 | * @author XiangHan | ||
| 8 | * @date 2022-07-07 | ||
| 9 | */ | ||
| 10 | public interface GrowthReportService { | ||
| 11 | |||
| 12 | /** | ||
| 13 | * 根据ID查询 | ||
| 14 | * @param id ID | ||
| 15 | * @return GrowthReportDTO | ||
| 16 | */ | ||
| 17 | GrowthReportDTO findById(Long id); | ||
| 18 | |||
| 19 | void create(GrowthReport resources); | ||
| 20 | |||
| 21 | void update(GrowthReport resources); | ||
| 22 | |||
| 23 | void delete(Long id); | ||
| 24 | |||
| 25 | /** | ||
| 26 | * | ||
| 27 | * @param platformAccount | ||
| 28 | * @param weekFirstDay | ||
| 29 | * @param weekLastDay | ||
| 30 | * @return | ||
| 31 | */ | ||
| 32 | GrowthReportDTO findByPlatformAccountAndStartDateAndEndDate(String platformAccount, String weekFirstDay, String weekLastDay); | ||
| 33 | |||
| 34 | |||
| 35 | Integer updateGrowthReportData(Long id, String data); | ||
| 36 | } |
| 1 | package com.topdraw.business.module.user.iptv.growreport.service.dto; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | import java.sql.Timestamp; | ||
| 5 | import java.io.Serializable; | ||
| 6 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
| 7 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; | ||
| 8 | |||
| 9 | |||
| 10 | /** | ||
| 11 | * @author XiangHan | ||
| 12 | * @date 2022-07-07 | ||
| 13 | */ | ||
| 14 | @Data | ||
| 15 | public class GrowthReportDTO implements Serializable { | ||
| 16 | |||
| 17 | // 处理精度丢失问题 | ||
| 18 | @JsonSerialize(using= ToStringSerializer.class) | ||
| 19 | private Long id; | ||
| 20 | |||
| 21 | // 用户id | ||
| 22 | private Long userId; | ||
| 23 | |||
| 24 | // 会员id | ||
| 25 | private Long memberId; | ||
| 26 | |||
| 27 | // 会员code | ||
| 28 | private String memberCode; | ||
| 29 | |||
| 30 | // 大屏账号 | ||
| 31 | private String platformAccount; | ||
| 32 | |||
| 33 | // 开始日期 | ||
| 34 | private String startDate; | ||
| 35 | |||
| 36 | // 结束时间 | ||
| 37 | private String endDate; | ||
| 38 | |||
| 39 | // 栏目播放时长数据 | ||
| 40 | private String data; | ||
| 41 | |||
| 42 | // 创建时间 | ||
| 43 | private Timestamp createTime; | ||
| 44 | |||
| 45 | // 修改时间 | ||
| 46 | private Timestamp updateTime; | ||
| 47 | } |
| 1 | package com.topdraw.business.module.user.iptv.growreport.service.dto; | ||
| 2 | |||
| 3 | import com.fasterxml.jackson.databind.annotation.JsonSerialize; | ||
| 4 | import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; | ||
| 5 | import lombok.Data; | ||
| 6 | |||
| 7 | import java.io.Serializable; | ||
| 8 | import java.sql.Timestamp; | ||
| 9 | import java.util.List; | ||
| 10 | |||
| 11 | |||
| 12 | /** | ||
| 13 | * @author XiangHan | ||
| 14 | * @date 2022-07-07 | ||
| 15 | */ | ||
| 16 | @Data | ||
| 17 | public class GrowthReportRequest implements Serializable { | ||
| 18 | |||
| 19 | private String platformAccount; | ||
| 20 | |||
| 21 | private List<CategoryContent> playDurationWithCategory; | ||
| 22 | |||
| 23 | @Data | ||
| 24 | public static class CategoryContent{ | ||
| 25 | private String categoryName; | ||
| 26 | private Long playDuration; | ||
| 27 | private String categoryCode; | ||
| 28 | } | ||
| 29 | |||
| 30 | } |
| 1 | package com.topdraw.business.module.user.iptv.growreport.service.impl; | ||
| 2 | |||
| 3 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
| 4 | import com.topdraw.utils.ValidationUtil; | ||
| 5 | import com.topdraw.business.module.user.iptv.growreport.repository.GrowthReportRepository; | ||
| 6 | import com.topdraw.business.module.user.iptv.growreport.service.GrowthReportService; | ||
| 7 | import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO; | ||
| 8 | import com.topdraw.business.module.user.iptv.growreport.service.mapper.GrowthReportMapper; | ||
| 9 | import org.springframework.beans.factory.annotation.Autowired; | ||
| 10 | import org.springframework.stereotype.Service; | ||
| 11 | import org.springframework.transaction.annotation.Propagation; | ||
| 12 | import org.springframework.transaction.annotation.Transactional; | ||
| 13 | import org.springframework.dao.EmptyResultDataAccessException; | ||
| 14 | import cn.hutool.core.lang.Snowflake; | ||
| 15 | import cn.hutool.core.util.IdUtil; | ||
| 16 | import org.springframework.data.domain.Page; | ||
| 17 | import org.springframework.data.domain.Pageable; | ||
| 18 | import org.springframework.util.Assert; | ||
| 19 | import com.topdraw.utils.PageUtil; | ||
| 20 | import com.topdraw.utils.QueryHelp; | ||
| 21 | |||
| 22 | import java.util.List; | ||
| 23 | import java.util.Map; | ||
| 24 | |||
| 25 | /** | ||
| 26 | * @author XiangHan | ||
| 27 | * @date 2022-07-07 | ||
| 28 | */ | ||
| 29 | @Service | ||
| 30 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | ||
| 31 | public class GrowthReportServiceImpl implements GrowthReportService { | ||
| 32 | |||
| 33 | @Autowired | ||
| 34 | private GrowthReportRepository growthReportRepository; | ||
| 35 | |||
| 36 | @Autowired | ||
| 37 | private GrowthReportMapper growthReportMapper; | ||
| 38 | |||
| 39 | @Override | ||
| 40 | @Transactional(readOnly = true) | ||
| 41 | public GrowthReportDTO findById(Long id) { | ||
| 42 | GrowthReport growthReport = this.growthReportRepository.findById(id).orElseGet(GrowthReport::new); | ||
| 43 | ValidationUtil.isNull(growthReport.getId(),"GrowthReport","id",id); | ||
| 44 | return this.growthReportMapper.toDto(growthReport); | ||
| 45 | } | ||
| 46 | |||
| 47 | @Override | ||
| 48 | @Transactional(rollbackFor = Exception.class) | ||
| 49 | public void create(GrowthReport resources) { | ||
| 50 | Snowflake snowflake = IdUtil.createSnowflake(1, 1); | ||
| 51 | resources.setId(snowflake.nextId()); | ||
| 52 | this.growthReportRepository.save(resources); | ||
| 53 | } | ||
| 54 | |||
| 55 | @Override | ||
| 56 | @Transactional(rollbackFor = Exception.class) | ||
| 57 | public void update(GrowthReport resources) { | ||
| 58 | GrowthReport growthReport = this.growthReportRepository.findById(resources.getId()).orElseGet(GrowthReport::new); | ||
| 59 | ValidationUtil.isNull( growthReport.getId(),"GrowthReport","id",resources.getId()); | ||
| 60 | growthReport.copy(resources); | ||
| 61 | this.growthReportRepository.save(growthReport); | ||
| 62 | } | ||
| 63 | |||
| 64 | @Override | ||
| 65 | @Transactional(rollbackFor = Exception.class) | ||
| 66 | public void delete(Long id) { | ||
| 67 | Assert.notNull(id, "The given id must not be null!"); | ||
| 68 | GrowthReport growthReport = this.growthReportRepository.findById(id).orElseThrow( | ||
| 69 | () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", GrowthReport.class, id), 1)); | ||
| 70 | this.growthReportRepository.delete(growthReport); | ||
| 71 | } | ||
| 72 | |||
| 73 | @Override | ||
| 74 | @Transactional(readOnly = true) | ||
| 75 | public GrowthReportDTO findByPlatformAccountAndStartDateAndEndDate(String platformAccount, String weekFirstDay, String weekLastDay) { | ||
| 76 | GrowthReport growthReport = this.growthReportRepository.findByPlatformAccountAndStartDateAndEndDate(platformAccount, weekFirstDay, weekLastDay).orElseGet(GrowthReport::new); | ||
| 77 | return this.growthReportMapper.toDto(growthReport); | ||
| 78 | } | ||
| 79 | |||
| 80 | @Override | ||
| 81 | @Transactional(rollbackFor = Exception.class) | ||
| 82 | public Integer updateGrowthReportData(Long id, String data) { | ||
| 83 | return this.growthReportRepository.updateGrowthReportData(id, data); | ||
| 84 | } | ||
| 85 | |||
| 86 | |||
| 87 | } |
| 1 | package com.topdraw.business.module.user.iptv.growreport.service.mapper; | ||
| 2 | |||
| 3 | import com.topdraw.base.BaseMapper; | ||
| 4 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
| 5 | import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO; | ||
| 6 | import org.mapstruct.Mapper; | ||
| 7 | import org.mapstruct.ReportingPolicy; | ||
| 8 | |||
| 9 | /** | ||
| 10 | * @author XiangHan | ||
| 11 | * @date 2022-07-07 | ||
| 12 | */ | ||
| 13 | @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) | ||
| 14 | public interface GrowthReportMapper extends BaseMapper<GrowthReportDTO, GrowthReport> { | ||
| 15 | |||
| 16 | } |
| ... | @@ -2,6 +2,8 @@ package com.topdraw.business.process.rest; | ... | @@ -2,6 +2,8 @@ package com.topdraw.business.process.rest; |
| 2 | 2 | ||
| 3 | import com.topdraw.annotation.AnonymousAccess; | 3 | import com.topdraw.annotation.AnonymousAccess; |
| 4 | import com.topdraw.business.module.common.validated.UpdateGroup; | 4 | import com.topdraw.business.module.common.validated.UpdateGroup; |
| 5 | import com.topdraw.business.module.member.address.domain.MemberAddress; | ||
| 6 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; | ||
| 5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 7 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 6 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 8 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| 7 | import com.topdraw.business.process.domian.member.MemberOperationBean; | 9 | import com.topdraw.business.process.domian.member.MemberOperationBean; |
| ... | @@ -28,6 +30,21 @@ public class MemberOperationController { | ... | @@ -28,6 +30,21 @@ public class MemberOperationController { |
| 28 | @Autowired | 30 | @Autowired |
| 29 | private MemberOperationService memberOperationService; | 31 | private MemberOperationService memberOperationService; |
| 30 | 32 | ||
| 33 | @RequestMapping(value = "/updateDefaultMemberAddressById") | ||
| 34 | @ApiOperation("设置默认地址") | ||
| 35 | @AnonymousAccess | ||
| 36 | public ResultInfo updateDefaultMemberAddressById(@Validated(value = {UpdateGroup.class}) @RequestBody MemberAddress resources) { | ||
| 37 | log.info("设置默认地址,参数 ==>> [updateDefaultMemberAddressById#{}]",resources); | ||
| 38 | Long id = resources.getId(); | ||
| 39 | if (Objects.isNull(id)) { | ||
| 40 | return ResultInfo.failure("设置默认地址失败,参数错误,id为空"); | ||
| 41 | } | ||
| 42 | |||
| 43 | MemberAddressDTO memberAddressDTO = this.memberOperationService.updateDefaultMemberAddressById(id); | ||
| 44 | |||
| 45 | return ResultInfo.success(memberAddressDTO); | ||
| 46 | } | ||
| 47 | |||
| 31 | @RequestMapping(value = "/updateVipByMemberId") | 48 | @RequestMapping(value = "/updateVipByMemberId") |
| 32 | @ApiOperation("手动修改vip") | 49 | @ApiOperation("手动修改vip") |
| 33 | @AnonymousAccess | 50 | @AnonymousAccess | ... | ... |
| ... | @@ -2,6 +2,8 @@ package com.topdraw.business.process.rest; | ... | @@ -2,6 +2,8 @@ package com.topdraw.business.process.rest; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.ObjectUtil; | 3 | import cn.hutool.core.util.ObjectUtil; |
| 4 | 4 | ||
| 5 | import com.alibaba.fastjson.JSON; | ||
| 6 | import com.alibaba.fastjson.JSONArray; | ||
| 5 | import com.alibaba.fastjson.JSONObject; | 7 | import com.alibaba.fastjson.JSONObject; |
| 6 | import com.topdraw.annotation.AnonymousAccess; | 8 | import com.topdraw.annotation.AnonymousAccess; |
| 7 | import com.topdraw.annotation.Log; | 9 | import com.topdraw.annotation.Log; |
| ... | @@ -14,6 +16,8 @@ import com.topdraw.business.module.user.app.domain.UserAppBind; | ... | @@ -14,6 +16,8 @@ import com.topdraw.business.module.user.app.domain.UserAppBind; |
| 14 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; | 16 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; |
| 15 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | 17 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; |
| 16 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 18 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 19 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
| 20 | import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportRequest; | ||
| 17 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | 21 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
| 18 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | 22 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| 19 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 23 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
| ... | @@ -40,6 +44,7 @@ import org.apache.commons.lang3.StringUtils; | ... | @@ -40,6 +44,7 @@ import org.apache.commons.lang3.StringUtils; |
| 40 | import org.springframework.beans.factory.annotation.Autowired; | 44 | import org.springframework.beans.factory.annotation.Autowired; |
| 41 | import org.springframework.util.Assert; | 45 | import org.springframework.util.Assert; |
| 42 | import org.springframework.util.Base64Utils; | 46 | import org.springframework.util.Base64Utils; |
| 47 | import org.springframework.util.CollectionUtils; | ||
| 43 | import org.springframework.validation.annotation.Validated; | 48 | import org.springframework.validation.annotation.Validated; |
| 44 | import org.springframework.web.bind.annotation.*; | 49 | import org.springframework.web.bind.annotation.*; |
| 45 | 50 | ||
| ... | @@ -73,6 +78,47 @@ public class UserOperationController { | ... | @@ -73,6 +78,47 @@ public class UserOperationController { |
| 73 | 78 | ||
| 74 | /******************************************************* APP ************************************/ | 79 | /******************************************************* APP ************************************/ |
| 75 | 80 | ||
| 81 | /** | ||
| 82 | * app账号退出登录 | ||
| 83 | * @param userApp app账号 | ||
| 84 | * @return ResultInfo | ||
| 85 | */ | ||
| 86 | @Log | ||
| 87 | @PostMapping(value = "/appSignOut") | ||
| 88 | @ApiOperation("app账号退出登录") | ||
| 89 | @AnonymousAccess | ||
| 90 | public ResultInfo appSignOut(@Validated @RequestBody UserApp userApp) { | ||
| 91 | log.info("app账号退出登录,参数 ==>> [appSignOut#{}]", userApp.getId()); | ||
| 92 | if (Objects.isNull(userApp.getId())) { | ||
| 93 | log.error("app账号退出登录失败,参数错误,id不得为空,[appSignOut#]"); | ||
| 94 | return ResultInfo.failure("app账号退出登录失败,参数错误,id不得为空"); | ||
| 95 | } | ||
| 96 | |||
| 97 | return ResultInfo.success(true); | ||
| 98 | } | ||
| 99 | |||
| 100 | /** | ||
| 101 | * 注销app账号 | ||
| 102 | * @param userApp app账号 | ||
| 103 | * @return ResultInfo | ||
| 104 | */ | ||
| 105 | @Log | ||
| 106 | @PostMapping(value = "/appCancellation") | ||
| 107 | @ApiOperation("注销app账号") | ||
| 108 | @AnonymousAccess | ||
| 109 | public ResultInfo appCancellation(@Validated @RequestBody UserApp userApp) { | ||
| 110 | log.info("注销app账号,参数 ==>> [appCancellation#{}]", userApp.getId()); | ||
| 111 | |||
| 112 | if (Objects.isNull(userApp.getId())) { | ||
| 113 | log.error("注销app账号失败,参数错误,id不得为空,[appCancellation#]"); | ||
| 114 | return ResultInfo.failure(""); | ||
| 115 | } | ||
| 116 | |||
| 117 | boolean result = this.userOperationService.appCancellation(userApp); | ||
| 118 | |||
| 119 | return ResultInfo.success(result); | ||
| 120 | } | ||
| 121 | |||
| 76 | @Log | 122 | @Log |
| 77 | @PostMapping(value = "/updateAppInfo") | 123 | @PostMapping(value = "/updateAppInfo") |
| 78 | @ApiOperation("修改app账号信息") | 124 | @ApiOperation("修改app账号信息") |
| ... | @@ -85,6 +131,14 @@ public class UserOperationController { | ... | @@ -85,6 +131,14 @@ public class UserOperationController { |
| 85 | return ResultInfo.failure("修改app账号密码失败,参数错误,id不得为空"); | 131 | return ResultInfo.failure("修改app账号密码失败,参数错误,id不得为空"); |
| 86 | } | 132 | } |
| 87 | 133 | ||
| 134 | String headimgurl = resources.getHeadimgurl(); | ||
| 135 | log.info("前端头像地址 ==>> [updateAppInfo#{}]", headimgurl); | ||
| 136 | if (StringUtils.isNotBlank(headimgurl) && (headimgurl.contains("http") || headimgurl.contains("https"))) { | ||
| 137 | String image = RestTemplateClient.netImage(headimgurl); | ||
| 138 | log.info("图片本地化后的图片地址 ==>> [updateAppInfo#{}]", image); | ||
| 139 | resources.setHeadimgurl(image); | ||
| 140 | } | ||
| 141 | |||
| 88 | UserAppSimpleDTO result = this.userOperationService.updateAppInfo(resources); | 142 | UserAppSimpleDTO result = this.userOperationService.updateAppInfo(resources); |
| 89 | return ResultInfo.success(result); | 143 | return ResultInfo.success(result); |
| 90 | } | 144 | } |
| ... | @@ -224,6 +278,27 @@ public class UserOperationController { | ... | @@ -224,6 +278,27 @@ public class UserOperationController { |
| 224 | 278 | ||
| 225 | /******************************************************* weixin ************************************/ | 279 | /******************************************************* weixin ************************************/ |
| 226 | 280 | ||
| 281 | @Log | ||
| 282 | @PostMapping(value = "/saveGrowthReport") | ||
| 283 | @ApiOperation("同步大屏成长报告") | ||
| 284 | @AnonymousAccess | ||
| 285 | public ResultInfo saveGrowthReport(@Validated @RequestBody String resources) { | ||
| 286 | log.info("同步大屏成长报告失败,参数 ==>> [saveGrowthReport#{}]", resources); | ||
| 287 | GrowthReportRequest growthReportRequest = JSON.parseObject(new String(Base64Utils.decode(resources.getBytes())), GrowthReportRequest.class); | ||
| 288 | |||
| 289 | String platformAccount = growthReportRequest.getPlatformAccount(); | ||
| 290 | List<GrowthReportRequest.CategoryContent> playDurationWithCategory = growthReportRequest.getPlayDurationWithCategory(); | ||
| 291 | if (!CollectionUtils.isEmpty(playDurationWithCategory)) { | ||
| 292 | GrowthReport growthReport = new GrowthReport(); | ||
| 293 | growthReport.setPlatformAccount(platformAccount); | ||
| 294 | growthReport.setData(JSONArray.toJSONString(playDurationWithCategory)); | ||
| 295 | boolean result = this.userOperationService.saveGrowthReport(growthReport); | ||
| 296 | return ResultInfo.success(result); | ||
| 297 | } | ||
| 298 | |||
| 299 | return ResultInfo.failure("保存失败"); | ||
| 300 | } | ||
| 301 | |||
| 227 | @PutMapping(value = "/updateWeixin") | 302 | @PutMapping(value = "/updateWeixin") |
| 228 | @ApiOperation("修改UserWeixin") | 303 | @ApiOperation("修改UserWeixin") |
| 229 | @AnonymousAccess | 304 | @AnonymousAccess | ... | ... |
| ... | @@ -6,6 +6,7 @@ import com.topdraw.business.module.user.app.domain.UserAppBind; | ... | @@ -6,6 +6,7 @@ import com.topdraw.business.module.user.app.domain.UserAppBind; |
| 6 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; | 6 | import com.topdraw.business.module.user.app.service.dto.UserAppDTO; |
| 7 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | 7 | import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; |
| 8 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 8 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 9 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
| 9 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | 10 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
| 10 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | 11 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
| 11 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 12 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
| ... | @@ -206,4 +207,14 @@ public interface UserOperationService { | ... | @@ -206,4 +207,14 @@ public interface UserOperationService { |
| 206 | * @return | 207 | * @return |
| 207 | */ | 208 | */ |
| 208 | boolean updatePasswordById(UserApp resources); | 209 | boolean updatePasswordById(UserApp resources); |
| 210 | |||
| 211 | /** | ||
| 212 | * | ||
| 213 | * @param growthReport | ||
| 214 | * @return | ||
| 215 | */ | ||
| 216 | boolean saveGrowthReport(GrowthReport growthReport); | ||
| 217 | |||
| 218 | |||
| 219 | boolean appCancellation(UserApp userApp); | ||
| 209 | } | 220 | } | ... | ... |
| ... | @@ -21,6 +21,9 @@ import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; | ... | @@ -21,6 +21,9 @@ import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO; |
| 21 | import com.topdraw.business.module.user.iptv.domain.UserConstant; | 21 | import com.topdraw.business.module.user.iptv.domain.UserConstant; |
| 22 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 22 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
| 23 | import com.topdraw.business.module.user.iptv.domain.UserTvBuilder; | 23 | import com.topdraw.business.module.user.iptv.domain.UserTvBuilder; |
| 24 | import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport; | ||
| 25 | import com.topdraw.business.module.user.iptv.growreport.service.GrowthReportService; | ||
| 26 | import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO; | ||
| 24 | import com.topdraw.business.module.user.iptv.service.UserTvService; | 27 | import com.topdraw.business.module.user.iptv.service.UserTvService; |
| 25 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; | 28 | import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; |
| 26 | import com.topdraw.business.module.user.iptv.service.dto.UserTvSimpleDTO; | 29 | import com.topdraw.business.module.user.iptv.service.dto.UserTvSimpleDTO; |
| ... | @@ -69,6 +72,7 @@ import org.springframework.util.CollectionUtils; | ... | @@ -69,6 +72,7 @@ import org.springframework.util.CollectionUtils; |
| 69 | 72 | ||
| 70 | import java.net.URLDecoder; | 73 | import java.net.URLDecoder; |
| 71 | import java.nio.charset.StandardCharsets; | 74 | import java.nio.charset.StandardCharsets; |
| 75 | import java.time.LocalDate; | ||
| 72 | import java.util.*; | 76 | import java.util.*; |
| 73 | import java.util.stream.Collectors; | 77 | import java.util.stream.Collectors; |
| 74 | 78 | ||
| ... | @@ -88,6 +92,8 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -88,6 +92,8 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 88 | @Autowired | 92 | @Autowired |
| 89 | private UserAppBindService userAppBindService; | 93 | private UserAppBindService userAppBindService; |
| 90 | @Autowired | 94 | @Autowired |
| 95 | private GrowthReportService growthReportService; | ||
| 96 | @Autowired | ||
| 91 | private UserWeixinRepository userWeixinRepository; | 97 | private UserWeixinRepository userWeixinRepository; |
| 92 | @Autowired | 98 | @Autowired |
| 93 | private UserCollectionService userCollectionService; | 99 | private UserCollectionService userCollectionService; |
| ... | @@ -192,6 +198,59 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -192,6 +198,59 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 192 | return this.userAppService.updatePasswordById(resources); | 198 | return this.userAppService.updatePasswordById(resources); |
| 193 | } | 199 | } |
| 194 | 200 | ||
| 201 | @Override | ||
| 202 | @Transactional(rollbackFor = Exception.class) | ||
| 203 | public boolean saveGrowthReport(GrowthReport growthReport) { | ||
| 204 | String platformAccount = growthReport.getPlatformAccount(); | ||
| 205 | |||
| 206 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | ||
| 207 | if (Objects.isNull(userTvDTO.getId())) { | ||
| 208 | log.error("保存成长报告失败,大屏信息不存在[saveGrowthReport#]"); | ||
| 209 | return false; | ||
| 210 | } | ||
| 211 | |||
| 212 | |||
| 213 | String weekFirstDay = com.topdraw.util.DateUtil.getWeekFirstDay(); | ||
| 214 | String weekLastDay = com.topdraw.util.DateUtil.getWeekLastDay(); | ||
| 215 | GrowthReportDTO growthReportDTO = this.growthReportService.findByPlatformAccountAndStartDateAndEndDate(platformAccount, weekFirstDay, weekLastDay); | ||
| 216 | |||
| 217 | if (Objects.isNull(growthReportDTO.getId())) { | ||
| 218 | |||
| 219 | Long id = userTvDTO.getId(); | ||
| 220 | Long memberId = userTvDTO.getMemberId(); | ||
| 221 | growthReport.setUserId(id); | ||
| 222 | growthReport.setMemberId(memberId); | ||
| 223 | growthReport.setStartDate(weekFirstDay); | ||
| 224 | growthReport.setEndDate(weekLastDay); | ||
| 225 | this.growthReportService.create(growthReport); | ||
| 226 | |||
| 227 | } else { | ||
| 228 | this.growthReportService.updateGrowthReportData(growthReportDTO.getId(), growthReport.getData()); | ||
| 229 | } | ||
| 230 | |||
| 231 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncsaveGrowthReport(growthReport); | ||
| 232 | |||
| 233 | return false; | ||
| 234 | } | ||
| 235 | |||
| 236 | @Override | ||
| 237 | public boolean appCancellation(UserApp userApp) { | ||
| 238 | UserAppDTO userAppDTO = this.userAppService.findById(userApp.getId()); | ||
| 239 | if (Objects.nonNull(userAppDTO.getId())){ | ||
| 240 | boolean b = this.userAppService.appCancellation(userApp.getId()); | ||
| 241 | if (b) { | ||
| 242 | List<UserAppBindDTO> userAppBindDTOS = this.userAppBindService.findByUserAppId(userAppDTO.getId()); | ||
| 243 | if (!CollectionUtils.isEmpty(userAppBindDTOS)) { | ||
| 244 | List<Long> ids = userAppBindDTOS.stream().map(t -> t.getId()).collect(Collectors.toList()); | ||
| 245 | this.userAppBindService.appCancellation(ids); | ||
| 246 | } | ||
| 247 | } | ||
| 248 | } | ||
| 249 | |||
| 250 | return true; | ||
| 251 | } | ||
| 252 | |||
| 253 | |||
| 195 | /** | 254 | /** |
| 196 | * 创建大屏账户同时创建会员 | 255 | * 创建大屏账户同时创建会员 |
| 197 | * | 256 | * |
| ... | @@ -1494,7 +1553,8 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1494,7 +1553,8 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 1494 | } | 1553 | } |
| 1495 | 1554 | ||
| 1496 | 1555 | ||
| 1497 | 1556 | @AsyncMqSend | |
| 1557 | public void asyncsaveGrowthReport(GrowthReport growthReport) {} | ||
| 1498 | @AsyncMqSend | 1558 | @AsyncMqSend |
| 1499 | public void asyncMemberAndUserWeixin4Iptv(MemberAndWeixinUserDTO memberAndWeixinUserDTO) {} | 1559 | public void asyncMemberAndUserWeixin4Iptv(MemberAndWeixinUserDTO memberAndWeixinUserDTO) {} |
| 1500 | @AsyncMqSend | 1560 | @AsyncMqSend | ... | ... |
| ... | @@ -2,6 +2,8 @@ package com.topdraw.business.process.service.impl.member; | ... | @@ -2,6 +2,8 @@ package com.topdraw.business.process.service.impl.member; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.util.ObjectUtil; | 3 | import cn.hutool.core.util.ObjectUtil; |
| 4 | import com.topdraw.aspect.AsyncMqSend; | 4 | import com.topdraw.aspect.AsyncMqSend; |
| 5 | import com.topdraw.business.module.member.address.service.MemberAddressService; | ||
| 6 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; | ||
| 5 | import com.topdraw.business.module.member.domain.Member; | 7 | import com.topdraw.business.module.member.domain.Member; |
| 6 | import com.topdraw.business.module.member.profile.service.MemberProfileService; | 8 | import com.topdraw.business.module.member.profile.service.MemberProfileService; |
| 7 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 9 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| ... | @@ -44,6 +46,8 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -44,6 +46,8 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
| 44 | private MemberProfileService memberProfileService; | 46 | private MemberProfileService memberProfileService; |
| 45 | @Autowired | 47 | @Autowired |
| 46 | private MemberVipHistoryService memberVipHistoryService; | 48 | private MemberVipHistoryService memberVipHistoryService; |
| 49 | @Autowired | ||
| 50 | private MemberAddressService memberAddressService; | ||
| 47 | 51 | ||
| 48 | @AsyncMqSend | 52 | @AsyncMqSend |
| 49 | public void asyncUpdateMemberVipAndVipExpireTime(MemberDTO memberDTO) {} | 53 | public void asyncUpdateMemberVipAndVipExpireTime(MemberDTO memberDTO) {} |
| ... | @@ -151,7 +155,22 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -151,7 +155,22 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
| 151 | return count; | 155 | return count; |
| 152 | } | 156 | } |
| 153 | 157 | ||
| 158 | @Override | ||
| 159 | public MemberAddressDTO updateDefaultMemberAddressById(Long id) { | ||
| 160 | MemberAddressDTO memberAddressDTO = this.memberAddressService.findById(id); | ||
| 161 | if (Objects.nonNull(memberAddressDTO.getId())) { | ||
| 162 | Long memberId = memberAddressDTO.getMemberId(); | ||
| 163 | Integer _count = this.memberAddressService.updateUnDefaultMemberAddressByMemberId(memberId); | ||
| 164 | if (_count > 0) { | ||
| 165 | Integer count = this.memberAddressService.updateDefaultMemberAddressById(id); | ||
| 166 | if (count > 0 ) { | ||
| 167 | return this.memberAddressService.findById(id); | ||
| 168 | } | ||
| 169 | } | ||
| 170 | } | ||
| 154 | 171 | ||
| 172 | return null; | ||
| 173 | } | ||
| 155 | 174 | ||
| 156 | 175 | ||
| 157 | @Override | 176 | @Override | ... | ... |
| 1 | package com.topdraw.business.process.service.member; | 1 | package com.topdraw.business.process.service.member; |
| 2 | 2 | ||
| 3 | import com.topdraw.business.module.member.address.service.dto.MemberAddressDTO; | ||
| 3 | import com.topdraw.business.module.member.domain.Member; | 4 | import com.topdraw.business.module.member.domain.Member; |
| 4 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
| 5 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 6 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
| ... | @@ -78,4 +79,5 @@ public interface MemberOperationService { | ... | @@ -78,4 +79,5 @@ public interface MemberOperationService { |
| 78 | 79 | ||
| 79 | Integer doUpdateGroupsBatch(List<Member> resources); | 80 | Integer doUpdateGroupsBatch(List<Member> resources); |
| 80 | 81 | ||
| 82 | MemberAddressDTO updateDefaultMemberAddressById(Long memberId); | ||
| 81 | } | 83 | } | ... | ... |
| 1 | package com.topdraw.util; | 1 | package com.topdraw.util; |
| 2 | 2 | ||
| 3 | import java.text.SimpleDateFormat; | ||
| 3 | import java.time.Instant; | 4 | import java.time.Instant; |
| 4 | import java.time.LocalDate; | 5 | import java.time.LocalDate; |
| 5 | import java.time.LocalDateTime; | 6 | import java.time.LocalDateTime; |
| ... | @@ -174,6 +175,29 @@ public class DateUtil { | ... | @@ -174,6 +175,29 @@ public class DateUtil { |
| 174 | return calendar.getTimeInMillis(); | 175 | return calendar.getTimeInMillis(); |
| 175 | } | 176 | } |
| 176 | 177 | ||
| 178 | public static String getWeekFirstDay() { | ||
| 179 | SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd"); | ||
| 180 | |||
| 181 | Calendar calendar1=Calendar.getInstance(); | ||
| 182 | |||
| 183 | calendar1.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); | ||
| 184 | |||
| 185 | System.out.println("本周日: "+sdf.format(calendar1.getTime())); | ||
| 186 | |||
| 187 | return sdf.format(calendar1.getTime()); | ||
| 188 | } | ||
| 189 | |||
| 190 | public static String getWeekLastDay() { | ||
| 191 | SimpleDateFormat sdf= new SimpleDateFormat("yyyy-MM-dd"); | ||
| 192 | |||
| 193 | Calendar calendar1=Calendar.getInstance(); | ||
| 194 | calendar1.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); | ||
| 195 | |||
| 196 | System.out.println("本周六: "+sdf.format(calendar1.getTime())); | ||
| 197 | |||
| 198 | return sdf.format(calendar1.getTime()); | ||
| 199 | } | ||
| 200 | |||
| 177 | /** | 201 | /** |
| 178 | * 时间戳转字符串 | 202 | * 时间戳转字符串 |
| 179 | * | 203 | * |
| ... | @@ -188,6 +212,10 @@ public class DateUtil { | ... | @@ -188,6 +212,10 @@ public class DateUtil { |
| 188 | } | 212 | } |
| 189 | 213 | ||
| 190 | public static void main(String[] args) { | 214 | public static void main(String[] args) { |
| 215 | String weekFirstDay = getWeekFirstDay(); | ||
| 216 | System.out.println(weekFirstDay); | ||
| 217 | String weekLastDay = getWeekLastDay(); | ||
| 218 | System.out.println(weekLastDay); | ||
| 191 | /*Long currentTime = System.currentTimeMillis(); | 219 | /*Long currentTime = System.currentTimeMillis(); |
| 192 | System.out.println("Current Time : " + currentTime + " = " + timestampToStr(currentTime, "GMT+8")); | 220 | System.out.println("Current Time : " + currentTime + " = " + timestampToStr(currentTime, "GMT+8")); |
| 193 | Long dailyStart = getDailyStartTime(currentTime, "GMT+8:00"); | 221 | Long dailyStart = getDailyStartTime(currentTime, "GMT+8:00"); |
| ... | @@ -201,7 +229,8 @@ public class DateUtil { | ... | @@ -201,7 +229,8 @@ public class DateUtil { |
| 201 | System.out.println("Month Start : " + monthStart + " = " + timestampToStr(monthStart, "GMT+8") + " Month End : " + monthEnd + " = " + timestampToStr(monthEnd, "GMT+8")); | 229 | System.out.println("Month Start : " + monthStart + " = " + timestampToStr(monthStart, "GMT+8") + " Month End : " + monthEnd + " = " + timestampToStr(monthEnd, "GMT+8")); |
| 202 | System.out.println("Year Start : " + yearStart + " = " + timestampToStr(yearStart, "GMT+8") + " Year End : " + yearEnd + " = " + timestampToStr(yearEnd, "GMT+8")); | 230 | System.out.println("Year Start : " + yearStart + " = " + timestampToStr(yearStart, "GMT+8") + " Year End : " + yearEnd + " = " + timestampToStr(yearEnd, "GMT+8")); |
| 203 | */ | 231 | */ |
| 204 | LocalDateTime lastDateTimeCurrentYear = getLastDateTimeSecondYear(); | 232 | // LocalDateTime lastDateTimeCurrentYear = getLastDateTimeSecondYear(); |
| 233 | |||
| 205 | } | 234 | } |
| 206 | 235 | ||
| 207 | } | 236 | } | ... | ... |
| ... | @@ -39,14 +39,14 @@ public class GeneratorCode extends BaseTest { | ... | @@ -39,14 +39,14 @@ public class GeneratorCode extends BaseTest { |
| 39 | @Rollback(value = false) | 39 | @Rollback(value = false) |
| 40 | @Transactional(rollbackFor = Exception.class) | 40 | @Transactional(rollbackFor = Exception.class) |
| 41 | public void generator() { | 41 | public void generator() { |
| 42 | var dbName = "uc_user_app_bind"; | 42 | var dbName = "uc_growth_report"; |
| 43 | // 表名称,支持多表 | 43 | // 表名称,支持多表 |
| 44 | var tableNames = Arrays.asList(dbName); | 44 | var tableNames = Arrays.asList(dbName); |
| 45 | String[] s = dbName.split("_"); | 45 | String[] s = dbName.split("_"); |
| 46 | 46 | ||
| 47 | var pre = s[0]; | 47 | var pre = s[0]; |
| 48 | var target1 = s[s.length-1]; | 48 | var target1 = s[s.length-1]; |
| 49 | var preRoute = "com.topdraw.business.module.user.app"; | 49 | var preRoute = "com.topdraw.business.module.user.iptv.growreport"; |
| 50 | StringBuilder builder = new StringBuilder(preRoute); | 50 | StringBuilder builder = new StringBuilder(preRoute); |
| 51 | // builder.append("wechatshare"); | 51 | // builder.append("wechatshare"); |
| 52 | // builder.append(target); | 52 | // builder.append(target); | ... | ... |
-
Please register or sign in to post a comment