Explorar o código

fix 获取全部已过期车票的账号列表

zoujiajian %!s(int64=3) %!d(string=hai) anos
pai
achega
d4f7ea99b6

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/mapper/AccountMapper.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.cyksj.model.entity.Account;
 import com.cyksj.model.entity.OrderDon;
 import com.cyksj.model.excel.ExcelAccountData;
+import com.cyksj.model.manage.views.AccountView;
 import com.cyksj.model.views.ExpiredAccountDataView;
 import org.apache.ibatis.annotations.Param;
 
@@ -25,4 +26,6 @@ public interface AccountMapper extends BaseMapper<Account> {
 	List<OrderDon> getNoAppleOneOrderDon(@Param("skuIds") List<Long> skuIds, @Param("yesZeroDate") Date yesZeroDate, @Param("thisZeroDate") Date thisZeroDate, @Param("noOrderStatus") List<String> noOrderStatus);
 
 	List<ExcelAccountData> getExpiredAccountViewNoPage(@Param("isCorpWx") Boolean isCorpWx, @Param("customerService") String customerService, @Param("goodsId") Long goodsId, @Param("skuId") Long skuId, @Param("account") String account, @Param("renewStatus") Boolean renewStatus, @Param("handleStatus") Boolean handleStatus, @Param("cnAccount") String cnAccount, @Param("usAccount") String usAccount, @Param("userId") Integer userId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("now") String now);
+
+	List<AccountView> getExpiredAllAccount();
 }

+ 7 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/AccountView.java

@@ -85,6 +85,13 @@ public class AccountView {
     @DbField("select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id and deleted is true")
     private Integer expiryCount;
 
+    @DbField("if((select s.account_id from (select s.account_id, count(*) num" +
+            " from (select ur.account_id, ur.relation_id" +
+            " from user_ticket_cleared_record ur where ur.deleted is true" +
+            " group by ur.account_id, ur.relation_id) s" +
+            "  group by s.account_id) s left join groups_trips gt on gt.account_id = s.account_id where s.account_id = a.id and s.num >= gt.num)is null,false,true)")
+    private Integer expiredAll;
+
     @DbField("max(gr.expiry_time)")
     private Date lastTicketTime;
 }

+ 28 - 0
netflix-dao/src/main/resources/mapper/AccountMapper.xml

@@ -167,4 +167,32 @@
             order by expiry_time
         </where>
     </select>
+
+    <select id="getExpiredAllAccount" resultType="com.cyksj.model.manage.views.AccountView">
+        select a.id,
+               a.account,
+               a.password,
+               a.goods_id,
+               a.bank_card,
+               a.start_time,
+               a.expiry_time,
+               a.amount,
+               a.remark,
+               a.cn_account,
+               a.us_account,
+               us_account,
+               a.created_time,
+               a.update_time,
+               g.title
+        from (select s.account_id, count(*) num
+              from (select ur.account_id, ur.relation_id
+                    from user_ticket_cleared_record ur
+                    where ur.deleted is true
+                    group by ur.account_id, ur.relation_id) s
+              group by s.account_id) s
+                 left join account a on a.id = s.account_id
+                 left join groups_trips gt on gt.account_id = s.account_id
+                 left join goods_don g on g.id = a.goods_id
+        where s.num >= gt.num
+    </select>
 </mapper>

+ 6 - 0
netflix-service/src/main/java/com/cyksj/service/mange/CmsAccountService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.cyksj.model.entity.Account;
 import com.cyksj.model.entity.OrderDon;
 import com.cyksj.model.excel.ExcelAccountData;
+import com.cyksj.model.manage.views.AccountView;
 import com.cyksj.model.views.ExpiredAccountDataView;
 
 import java.util.Date;
@@ -22,4 +23,9 @@ public interface CmsAccountService extends IService<Account> {
 	List<OrderDon> getNoAppleOneOrderDon(List<Long> skuIds, Date yesZeroDate, Date thisZeroDate, List<String> noOrderStatus);
 
 	List<ExcelAccountData> getExpiredAccountViewNoPage(Boolean isCorpWx, String customerService, Long goodsId, Long skuId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, String startDate, String endDate, String toString);
+
+	/**
+	 * 获取所有车票已过期的账号
+	 */
+	List<AccountView> getExpiredAllAccount();
 }

+ 5 - 0
netflix-service/src/main/java/com/cyksj/service/mange/account/CmsAccountServiceImpl.java

@@ -7,6 +7,7 @@ import com.cyksj.mapper.AccountMapper;
 import com.cyksj.model.entity.Account;
 import com.cyksj.model.entity.OrderDon;
 import com.cyksj.model.excel.ExcelAccountData;
+import com.cyksj.model.manage.views.AccountView;
 import com.cyksj.model.views.ExpiredAccountDataView;
 import com.cyksj.service.mange.CmsAccountService;
 import lombok.RequiredArgsConstructor;
@@ -46,4 +47,8 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
 		return accountMapper.getNoAppleOneOrderDon(skuIds, yesZeroDate, thisZeroDate, noOrderStatus);
 	}
 
+	@Override
+	public List<AccountView> getExpiredAllAccount() {
+		return accountMapper.getExpiredAllAccount();
+	}
 }

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

@@ -363,8 +363,8 @@ public class CmsAccountController {
 	 */
 	@GetMapping("/get/expired/platform")
 	public Result<String> getExpiredPlatform() {
-		List<UserTicketClearedRecordView> userTicket = beanSearcher.searchList(UserTicketClearedRecordView.class, MapUtils.builder().field(UserTicketClearedRecordView::getDeleted, true).build());
-		Set<String> platFormSet = userTicket.stream().map(UserTicketClearedRecordView::getPlatform).collect(Collectors.toSet());
+		List<AccountView> expiredAllAccount = accountService.getExpiredAllAccount();
+		Set<String> platFormSet = expiredAllAccount.stream().map(AccountView::getTitle).collect(Collectors.toSet());
 		String platForms = platFormSet.stream().collect(Collectors.joining("、"));
 		return GatewayResponse.SUCCESS.newBuilder().toResult(platForms);
 	}