Ver Fonte

add 添加有效子账号导出

zoujiajian há 3 anos atrás
pai
commit
09b6f6fee6

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

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 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.views.ExpiredAccountDataView;
 import org.apache.ibatis.annotations.Param;
 
@@ -22,4 +23,6 @@ public interface AccountMapper extends BaseMapper<Account> {
 	List<Account> getNoAppleOneAccount(String appleOne);
 
 	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("goodsId") Integer goodsId, @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);
 }

+ 84 - 0
netflix-dao/src/main/java/com/cyksj/model/excel/ExcelAccountData.java

@@ -0,0 +1,84 @@
+package com.cyksj.model.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/*
+ *项目名: netflix
+ *文件名: ExcelAccountData
+ *创建者: JavaZou
+ *创建时间:2022/12/6 14:10
+ */
+@Getter
+@Setter
+public class ExcelAccountData {
+
+	/**
+	 * 所属平台
+	 */
+	@ExcelProperty("所属平台")
+	private String platform;
+
+	/**
+	 * 主账号
+	 */
+	@ExcelProperty("账号")
+	private String account;
+
+	/**
+	 * 主账号密码
+	 */
+	@ExcelProperty("密码")
+	private String password;
+
+	/**
+	 * 类型
+	 */
+	@ExcelProperty("规格")
+	private String type;
+
+	/**
+	 * 用户id
+	 */
+	@ExcelProperty("用户ID")
+	private Integer userId;
+
+	/**
+	 * 用户头像
+	 */
+	@ExcelProperty("用户头像")
+	private String img;
+
+	/**
+	 * 用户昵称
+	 */
+	@ExcelProperty("用户昵称")
+	private String nickName;
+
+	/**
+	 * 购买时间
+	 */
+	@ExcelProperty("购买时间")
+	private Date payTime;
+
+	/**
+	 * 过期时间
+	 */
+	@ExcelProperty("过期时间")
+	private Date expiryTime;
+
+	/**
+	 * 用户续费意愿
+	 */
+	@ExcelProperty("用户续费意愿")
+	private Boolean renewStatus;
+
+	/**
+	 * 是否处理过
+	 */
+	@ExcelProperty("是否处理过")
+	private Boolean isHandle;
+}

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

@@ -75,4 +75,57 @@
         </foreach>
         and od.created_time between #{yesZeroDate} and #{thisZeroDate}
     </select>
+
+    <select id="getExpiredAccountViewNoPage" resultType="com.cyksj.model.excel.ExcelAccountData">
+        select gr.id as relationId,
+        a.title as platform,
+        a.account,
+        a.password,
+        a.us_account,
+        a.cn_account,
+        concat(gdk.spec_val,'¥',cast(gdk.price/100 as decimal(10,2))) as 'type',
+        gr.user_id,
+        gr.account as userAccount,
+        u.headimgurl as img,
+        u.nickname,
+        gr.start_time as payTime,
+        gr.expiry_time,
+        gr.renew_status,
+        gr.is_handle
+        from `account` a left join `groups_trips` gt on gt.account_id = a.id
+        left join `groups_relation` gr on gr.groups_id = gt.id
+        left join `goods_don_sku` gdk on gdk.id = gt.sku_id
+        left join `user` u on gr.user_id = u.id
+        <where>
+            <if test="goodsId != null">
+                a.goods_id = #{goodsId}
+            </if>
+            <if test="account != null and account != ''">
+                and a.account like '%${account}%'
+            </if>
+            <if test="renewStatus != null">
+                and gr.renew_status is ${renewStatus}
+            </if>
+            <if test="handleStatus != null">
+                and gr.is_handle is ${handleStatus}
+            </if>
+            <if test="cnAccount != null and cnAccount != ''">
+                and a.cn_account = #{cnAccount}
+            </if>
+            <if test="usAccount != null and usAccount != ''">
+                and a.us_account = #{usAccount}
+            </if>
+            <if test="userId != null">
+                and gr.user_id = #{userId}
+            </if>
+            <if test="startTime != null">
+                and gr.expiry_time >= #{startTime}
+            </if>
+            <if test="endTime != null">
+                and gr.expiry_time &lt; #{endTime}
+            </if>
+            and gr.expiry_time > #{now}
+            order by expiry_time
+        </where>
+    </select>
 </mapper>

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 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.views.ExpiredAccountDataView;
 
 import java.util.Date;
@@ -19,4 +20,6 @@ public interface CmsAccountService extends IService<Account> {
 	List<Account> getNoAppleOneAccount(String appleOne);
 
 	List<OrderDon> getNoAppleOneOrderDon(List<Long> skuIds, Date yesZeroDate, Date thisZeroDate, List<String> noOrderStatus);
+
+	List<ExcelAccountData> getExpiredAccountViewNoPage(Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, String startDate, String endDate, String toString);
 }

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

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 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.views.ExpiredAccountDataView;
 import com.cyksj.service.mange.CmsAccountService;
 import lombok.RequiredArgsConstructor;
@@ -30,6 +31,11 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
 		return accountMapper.getExpiredAccountView(goodsId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime, now, new Page<>(offset, limit));
 	}
 
+	@Override
+	public List<ExcelAccountData> getExpiredAccountViewNoPage(Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, String startTime, String endTime, String now) {
+		return accountMapper.getExpiredAccountViewNoPage(goodsId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime, now);
+	}
+
 	@Override
 	public List<Account> getNoAppleOneAccount(String appleOne) {
 		return accountMapper.getNoAppleOneAccount(appleOne);

+ 5 - 0
netflix-service/src/main/java/com/cyksj/service/mange/statistics/StatisticsDataService.java

@@ -2,9 +2,12 @@ package com.cyksj.service.mange.statistics;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.cyksj.dto.Result;
+import com.cyksj.model.excel.ExcelAccountData;
 import com.cyksj.model.views.BackgroundDataView;
 import com.cyksj.model.views.ExpiredAccountDataView;
 
+import java.util.List;
+
 /*
  *项目名: netflix
  *文件名: StatisticsService
@@ -19,4 +22,6 @@ public interface StatisticsDataService {
 	Result<String> updateRenewStatus(Integer relationId);
 
 	Result<String> updateHandleStatus(Integer relationId);
+
+	List<ExcelAccountData> getExpiredAccountViewNoPage(Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime);
 }

+ 15 - 0
netflix-service/src/main/java/com/cyksj/service/mange/statistics/impl/StatisticsDataServiceImpl.java

@@ -14,6 +14,7 @@ import com.cyksj.mapper.manage.statistics.AppleOneDataMapper;
 import com.cyksj.mapper.manage.statistics.RealGoodsDataMapper;
 import com.cyksj.mapper.manage.statistics.StreamingAccountDataMapper;
 import com.cyksj.model.entity.*;
+import com.cyksj.model.excel.ExcelAccountData;
 import com.cyksj.model.views.BackgroundDataView;
 import com.cyksj.model.views.ExpiredAccountDataView;
 import com.cyksj.redis.RedisService;
@@ -97,6 +98,20 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		return expiredAccountDataViews;
 	}
 
+	@Override
+	public List<ExcelAccountData> getExpiredAccountViewNoPage(Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime) {
+		String startDate = null;
+		String endDate = null;
+		if (startTime != null) {
+			startDate = DateTime.of(startTime).toString();
+		}
+		if (endTime != null) {
+			endDate = DateTime.of(endTime).toString();
+		}
+		List<ExcelAccountData> expiredAccountDataViews = accountService.getExpiredAccountViewNoPage(goodsId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startDate, endDate, DateTime.now().toString());
+		return expiredAccountDataViews;
+	}
+
 	@Override
 	public Result<String> updateRenewStatus(Integer relationId) {
 		GroupsRelation groupsRelation = groupsRelationMapper.selectById(relationId);

+ 0 - 6
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -539,12 +539,6 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 			orderDon.setCouponMoney(couponMoney);
 			orderDon.setCouponUserId(couponUser.getId());
 		}
-		if (relationId != 0) {
-			Long gtSkuId = groupsRelationMapper.getGroupTripsSkuIdByRelationId(relationId);
-			if (!gtSkuId.equals(orderDon.getSkuId())) {
-				throw BusinessRuntimeException.getInstance("车位与车队规格不一致");
-			}
-		}
 
 		this.saveOrUpdate(orderDon);
 

+ 15 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/statistics/StatisticsDataController.java

@@ -1,15 +1,21 @@
 package com.cyksj.web.controller.manage.statistics;
 
+import com.alibaba.excel.support.ExcelTypeEnum;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
+import com.cyksj.model.excel.ExcelAccountData;
 import com.cyksj.model.views.BackgroundDataView;
 import com.cyksj.model.views.ExpiredAccountDataView;
 import com.cyksj.service.mange.statistics.StatisticsDataService;
+import com.cyksj.web.util.EasyExcelUtils;
 import lombok.RequiredArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
 /*
  *项目名: netflix
  *文件名: StatisticsDataController
@@ -41,6 +47,15 @@ public class StatisticsDataController {
 		return GatewayResponse.SUCCESS.newBuilder().toResult(statisticsDataService.getExpiredAccountView(goodsId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime, start, limit));
 	}
 
+	/**
+	 * 导出有效子账号数
+	 */
+	@GetMapping("/export/account")
+	public void exportAccount(Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime, HttpServletResponse response) {
+		List<ExcelAccountData> expiredAccountView = statisticsDataService.getExpiredAccountViewNoPage(goodsId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime);
+		EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelAccountData.class, expiredAccountView, "有效子账号", "有效子账号", ExcelTypeEnum.XLSX, null);
+	}
+
 	/**
 	 * 到期状态续费意愿修改
 	 */