Sfoglia il codice sorgente

过期车票座位号返回;清除过期车票记录;添加近一个月未修改密码账号条件

zoujiajian 3 anni fa
parent
commit
c36fe61668

+ 4 - 0
netflix-dao/src/main/java/com/cyksj/mapper/AccountUpdatePasswordRecordMapper.java

@@ -1,8 +1,11 @@
 package com.cyksj.mapper;
 
+import cn.hutool.core.date.DateTime;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.cyksj.model.entity.AccountUpdatePasswordRecord;
 
+import java.util.List;
+
 /*
  *项目名: netflix
  *文件名: AccountUpdatePasswordRecordMapper
@@ -10,4 +13,5 @@ import com.cyksj.model.entity.AccountUpdatePasswordRecord;
  *创建时间:2023/3/27 14:34
  */
 public interface AccountUpdatePasswordRecordMapper extends BaseMapper<AccountUpdatePasswordRecord> {
+	List<Long> selectPasswordNotChangedThePastMonthAccountId(DateTime pastMonth);
 }

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/UserTicketClearedRecord.java

@@ -31,6 +31,8 @@ public class UserTicketClearedRecord extends BaseEntity{
 
 	private Long relationId;
 
+	private Integer num;
+
 	private Long newRelationId;
 
 	private Date startTime;

+ 5 - 1
netflix-dao/src/main/java/com/cyksj/model/views/UserTicketClearedRecordView.java

@@ -18,7 +18,8 @@ import java.util.Date;
 @Setter
 @SearchBean(tables = "user_ticket_cleared_record ur left join account a on a.id = ur.account_id" +
 		" left join goods_don g on g.id = ur.goods_id left join goods_don_sku gdk on gdk.id = ur.sku_id" +
-		" left join user u on u.id = ur.user_id left join corp_user cu on cu.unionid = u.unionid and cu.unionid != ''")
+		" left join user u on u.id = ur.user_id left join corp_user cu on cu.unionid = u.unionid and cu.unionid != ''",
+		where = "ur.deleted is true")
 public class UserTicketClearedRecordView {
 	@DbField("ur.id")
 	private Long recordId;
@@ -35,6 +36,9 @@ public class UserTicketClearedRecordView {
 	@DbField("ur.relation_id")
 	private Long relationId;
 
+	@DbField("ur.num")
+	private Integer num;
+
 	@DbField("ur.account_id")
 	private Long accountId;
 

+ 18 - 0
netflix-dao/src/main/resources/mapper/AccountUpdatePasswordRecordMapper.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.cyksj.mapper.AccountUpdatePasswordRecordMapper">
+
+
+    <select id="selectPasswordNotChangedThePastMonthAccountId" resultType="java.lang.Long">
+        select a.id
+        from `account` a
+        where not EXISTS(select *
+                         from `account_update_password_record` ar
+                         where ar.account_id = a.id
+                           and ar.created_time >= #{pastMonth} limit 1)
+          and (select count(ur.id)
+               from user_ticket_cleared_record ur
+               where ur.account_id = a.id and deleted is true and source = 'self') > 0
+    </select>
+</mapper>

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationClearServiceImpl.java

@@ -49,6 +49,7 @@ public class GroupRelationClearServiceImpl implements GroupRelationClearService
 	public void clearTicket(GroupsRelation relation, UserTicketClearedRecord.Source source) {
 		Long relationId = relation.getId();
 		Long newRelationId = relation.getNewRelationId();
+		Integer num = relation.getNum();
 		final GroupsRelation.Status relationStatus = relation.getStatus();
 		//记录用户被清除车票历史记录
 		GroupsRelationView groupsRelation = beanSearcher.searchFirst(GroupsRelationView.class,
@@ -87,6 +88,7 @@ public class GroupRelationClearServiceImpl implements GroupRelationClearService
 				userTicketClearedRecord.setAccountId(groupsRelation.getAccountId());
 				userTicketClearedRecord.setAccount(groupsRelation.getTripsAccount());
 				userTicketClearedRecord.setRelationId(relationId);
+				userTicketClearedRecord.setNum(num);
 				userTicketClearedRecord.setUserId(userId);
 				userTicketClearedRecord.setSource(source);
 				userTicketClearedRecord.setGoodsId(groupsRelation.getGoodsId());

+ 31 - 3
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java

@@ -96,11 +96,13 @@ public class CmsAccountController {
 
 	private final AccountDoubleVerifyRecordMapper doubleVerifyRecordMapper;
 
+	private final AccountUpdatePasswordRecordMapper accountUpdatePasswordRecordMapper;
+
 	private final RedisService redisService;
 
 	@GetMapping("/get")
 	@SaCheckPermission("account:view")
-	public Result<SearchResult<AccountView>> get(Long userId, String showId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday) {
+	public Result<SearchResult<AccountView>> get(Long userId, String showId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, Boolean pwdNotChangedThePastPwd) {
 		MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
 		if (StrUtil.isNotEmpty(expiryStartTime) || StrUtil.isNotEmpty(expiryEndTime)) {
 			mapBuilder.field(AccountView::getExpiryTime, expiryStartTime, expiryEndTime)
@@ -123,6 +125,12 @@ public class CmsAccountController {
 			extra_sql += "(if((select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self')>=4,true,false)) = 1";
 		}
 
+		if (pwdNotChangedThePastPwd != null && pwdNotChangedThePastPwd) {
+			DateTime pastMonth = DateUtil.offsetMonth(DateTime.now(), -1);
+			List<Long> accountIds = accountUpdatePasswordRecordMapper.selectPasswordNotChangedThePastMonthAccountId(pastMonth);
+			mapBuilder.field(AccountView::getId, accountIds).op(Operator.InList);
+		}
+
 		if (existsExpired != null && existsExpired) {
 			if (StrUtil.isNotEmpty(extra_sql)) {
 				extra_sql += " and";
@@ -178,7 +186,7 @@ public class CmsAccountController {
     @GetMapping("/export/account")
     @SaCheckPermission("account:export")
     @Log(module = "平台管理/导出账号", businessType = BusinessType.EXPORT, isSaveRequestData = true)
-    public void exportAccount(Long userId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, HttpServletResponse response) {
+    public void exportAccount(Long userId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, Boolean pwdNotChangedThePastPwd, HttpServletResponse response) {
         MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
         if (StrUtil.isNotEmpty(expiryStartTime) || StrUtil.isNotEmpty(expiryEndTime)) {
             mapBuilder.field(ExcelManageAccountData::getExpiryTime, expiryStartTime, expiryEndTime)
@@ -198,6 +206,12 @@ public class CmsAccountController {
 		    extra_sql += "(if((select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true and source = 'self')>=4,true,false)) = 1";
 	    }
 
+	    if (pwdNotChangedThePastPwd != null && pwdNotChangedThePastPwd) {
+		    DateTime pastMonth = DateUtil.offsetMonth(DateTime.now(), -1);
+		    List<Long> accountIds = accountUpdatePasswordRecordMapper.selectPasswordNotChangedThePastMonthAccountId(pastMonth);
+		    mapBuilder.field(AccountView::getId, accountIds).op(Operator.InList);
+	    }
+
 	    if (existsExpired != null && existsExpired) {
 		    if (StrUtil.isNotEmpty(extra_sql)) {
 			    extra_sql += " and";
@@ -511,10 +525,24 @@ public class CmsAccountController {
 	 */
 	@GetMapping("/get/expired/ticket")
 	public Result<SearchResult<UserTicketClearedRecordView>> getUserHadExpiredTicket() {
-		SearchResult<UserTicketClearedRecordView> search = beanSearcher.search(UserTicketClearedRecordView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
+		SearchResult<UserTicketClearedRecordView> search = beanSearcher.search(UserTicketClearedRecordView.class, MapUtils.flatBuilder(request.getParameterMap())
+				.field(UserTicketClearedRecordView::getSource, UserTicketClearedRecord.Source.self.name())
+				.build());
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
 
+	/**
+	 * 移除账号过期用户车票记录
+	 */
+	@DeleteMapping("/clear/expired/ticket/{recordId}")
+	public Result<String> clearExpiredTicket(@PathVariable Long recordId) {
+		userTicketClearedRecordMapper.update(null, Wrappers.lambdaUpdate(UserTicketClearedRecord.class)
+				.set(UserTicketClearedRecord::getDeleted, false)
+				.eq(UserTicketClearedRecord::getId, recordId));
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
+
+
 	/**
 	 * 账号未过期车票列表
 	 */