Просмотр исходного кода

fix 账号数据统计;实物分销

zoujiajian 3 лет назад
Родитель
Сommit
cb65760746
16 измененных файлов с 356 добавлено и 58 удалено
  1. 2 2
      netflix-dao/src/main/java/com/cyksj/mapper/AccountMapper.java
  2. 2 0
      netflix-dao/src/main/java/com/cyksj/model/entity/UserTicketClearedRecord.java
  3. 170 0
      netflix-dao/src/main/java/com/cyksj/model/excel/ExcelRealGoodsOrderData.java
  4. 3 0
      netflix-dao/src/main/java/com/cyksj/model/manage/views/AccountView.java
  5. 3 0
      netflix-dao/src/main/java/com/cyksj/model/manage/views/OrderDonView.java
  6. 5 0
      netflix-dao/src/main/java/com/cyksj/model/views/BackgroundDataView.java
  7. 4 1
      netflix-dao/src/main/java/com/cyksj/model/views/UserTicketClearedRecordView.java
  8. 6 0
      netflix-dao/src/main/resources/mapper/AccountMapper.xml
  9. 2 2
      netflix-service/src/main/java/com/cyksj/service/mange/CmsAccountService.java
  10. 4 4
      netflix-service/src/main/java/com/cyksj/service/mange/account/CmsAccountServiceImpl.java
  11. 8 4
      netflix-service/src/main/java/com/cyksj/service/mange/statistics/StatisticsDataService.java
  12. 40 23
      netflix-service/src/main/java/com/cyksj/service/mange/statistics/impl/StatisticsDataServiceImpl.java
  13. 20 0
      netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsOrderController.java
  14. 57 4
      netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java
  15. 24 3
      netflix-web/src/main/java/com/cyksj/web/controller/manage/distribute/DistributeController.java
  16. 6 15
      netflix-web/src/main/java/com/cyksj/web/controller/manage/statistics/StatisticsDataController.java

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

@@ -18,11 +18,11 @@ import java.util.List;
  */
 public interface AccountMapper extends BaseMapper<Account> {
 
-	IPage<ExpiredAccountDataView> getExpiredAccountView(@Param("isCorpWx") Boolean isCorpWx, @Param("customerService") String customerService, @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, @Param("page") Page page);
+	IPage<ExpiredAccountDataView> getExpiredAccountView(@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, @Param("page") Page page);
 
 	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("isCorpWx") Boolean isCorpWx, @Param("customerService") String customerService, @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);
+	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);
 }

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

@@ -35,6 +35,8 @@ public class UserTicketClearedRecord extends BaseEntity{
 
 	private Date expiryTime;
 
+	private Boolean deleted;
+
 	@Getter
 	public enum Source{
 		self("自购"),

+ 170 - 0
netflix-dao/src/main/java/com/cyksj/model/excel/ExcelRealGoodsOrderData.java

@@ -0,0 +1,170 @@
+package com.cyksj.model.excel;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.cyksj.model.entity.OrderDon;
+import com.ejlchina.searcher.bean.DbField;
+import com.ejlchina.searcher.bean.SearchBean;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/*
+ *项目名: netflix
+ *文件名: ExcelRealGoodsOrderData
+ *创建者: JavaZou
+ *创建时间:2023/3/8 12:01
+ */
+@Getter
+@Setter
+@SearchBean(tables = "(SELECT @i:=0) AS tableNo,order_don o left join goods_don_sku sku on o.sku_id = sku.id " +
+		"left join goods_don g on g.id = sku.goods_id " +
+		"left join user u on o.user_id = u.id " +
+		"left join groups_relation gr on gr.id = o.relation_id " +
+		"left join channel_popularize cp on o.popularize_id = cp.id " +
+		"left join channel c on c.id = cp.channel_id"
+)
+public class ExcelRealGoodsOrderData {
+
+	@DbField("c.id")
+	@ExcelIgnore
+	private Long channelId;
+
+	@DbField("o.relation_id")
+	@ExcelIgnore
+	private Long relationId;
+
+	@DbField("gr.groups_id")
+	@ExcelIgnore
+	private Long groupsId;
+
+	@DbField("gr.account")
+	@ExcelIgnore
+	private String account;
+
+	@DbField("g.type")
+	@ExcelIgnore
+	private Integer goodsDonType;
+
+	@DbField("g.second_type")
+	@ExcelIgnore
+	private Integer secondType;
+
+	@DbField("o.order_no")
+	@ExcelIgnore
+	private String orderNo;
+
+	@DbField("o.transaction_id")
+	@ExcelIgnore
+	private String transactionId;
+
+	@DbField("g.title")
+	@ExcelIgnore
+	private String title;
+
+	@DbField("u.id")
+	@ExcelIgnore
+	private Long userId;
+
+	@DbField("case when u.login_phone != '' then 'phone' when u.email != '' then 'email' when u.open_id != '' then 'wechat' else 'wechat' end")
+	@ExcelIgnore
+	private String register;
+
+	@DbField("o.status")
+	@ExcelIgnore
+	private OrderDon.Status status;
+
+	@DbField("o.type")
+	@ExcelIgnore
+	private OrderDon.Type type;
+
+	@DbField("o.order_type")
+	@ExcelIgnore
+	private Integer orderType;
+
+	@DbField("o.num")
+	@ExcelIgnore
+	private Integer num;
+
+	@DbField("o.created_time")
+	@ExcelIgnore
+	private Date createdTime;
+
+	@DbField("o.ex_code")
+	@ExcelIgnore
+	private String exCode;
+
+	@ExcelProperty("序号")
+	@DbField("(@i:=@i+1) AS '序号'")
+	private Long id;
+
+	/**
+	 * 收货人
+	 */
+	@ExcelProperty("姓名")
+	@DbField("odt.receiver")
+	private String receiver;
+
+	/**
+	 * 手机号
+	 */
+	@ExcelProperty("手机号码")
+	@DbField("odt.phone")
+	private String phone;
+
+	@ExcelProperty("座机号")
+	private String landLine;
+
+	@ExcelProperty("公司名称")
+	private String company;
+
+	/**
+	 * 省份
+	 */
+	@ExcelProperty("省")
+	@DbField("odt.province")
+	private String province;
+
+	/**
+	 * 城市
+	 */
+	@ExcelProperty("市")
+	@DbField("odt.city")
+	private String city;
+
+	/**
+	 * 区/县
+	 */
+	@ExcelProperty("区")
+	@DbField("odt.district")
+	private String district;
+
+	/**
+	 * 详细地址
+	 */
+	@ExcelProperty("详细地址")
+	@DbField("odt.address")
+	private String address;
+
+	@ExcelProperty("付款方式")
+	private String payType;
+
+	@ExcelProperty("月结卡号")
+	private String monthCardNo;
+
+	@ExcelProperty("托寄物名称")
+	private String realGoodName;
+
+	@ExcelProperty("代收卡号(可选增加服务)")
+	private String toMoneyCardNumber;
+
+	@ExcelProperty("代收金额(可选增值服务)")
+	private String toMoney;
+
+	@ExcelProperty("收件统编")
+	private String deliveryNumber;
+
+	@ExcelProperty("备注")
+	private String remark;
+}

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

@@ -80,4 +80,7 @@ public class AccountView {
     @DbField("gdk.spec_val")
     private String specVal;
 
+    @DbField("select count(ur.id) from user_ticket_cleared_record ur where ur.account_id = a.id")
+    private Integer expiredCount;
+
 }

+ 3 - 0
netflix-dao/src/main/java/com/cyksj/model/manage/views/OrderDonView.java

@@ -100,6 +100,9 @@ public class OrderDonView {
     @DbField("o.money")
     private BigDecimal money;
 
+    @DbField("o.refund_money")
+    private BigDecimal refundMoney;
+
     @DbField("o.status")
     private OrderDon.Status status;
 

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/views/BackgroundDataView.java

@@ -178,4 +178,9 @@ public class BackgroundDataView {
 	 */
 	private Integer numOfMonthEmptyTripsNetflix;
 
+	/**
+	 * 待发货实物订单
+	 */
+	private Integer waitingSendRealOrder;
+
 }

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

@@ -48,9 +48,12 @@ public class UserTicketClearedRecordView {
 	@DbField("ur.start_time")
 	private Date startTime;
 
-	@DbField("expiry.start_time")
+	@DbField("ur.expiry_time")
 	private Date expiryTime;
 
+	@DbField("ur.deleted")
+	private Boolean deleted;
+
 	@DbField("g.title")
 	private String goodsTitle;
 

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

@@ -42,6 +42,9 @@
             <if test="goodsId != null">
                 and a.goods_id = #{goodsId}
             </if>
+            <if test="skuId != null">
+                and gdk.id = #{skuId}
+            </if>
             <if test="account != null and account != ''">
                 and a.account like '%${account}%'
             </if>
@@ -132,6 +135,9 @@
             <if test="goodsId != null">
                 and a.goods_id = #{goodsId}
             </if>
+            <if test="skuId != null">
+                and gdk.id = #{skuId}
+            </if>
             <if test="account != null and account != ''">
                 and a.account like '%${account}%'
             </if>

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

@@ -15,11 +15,11 @@ import java.util.List;
  * @date 2022/9/27 6:23 PM
  */
 public interface CmsAccountService extends IService<Account> {
-	IPage<ExpiredAccountDataView> getExpiredAccountView(Boolean isCorpWx, String customerService, Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, String startTime, String endTime, String now, Long offset, Long limit);
+	IPage<ExpiredAccountDataView> getExpiredAccountView(Boolean isCorpWx, String customerService, Long goodsId, Long skuId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, String startTime, String endTime, String now, Long offset, Long limit);
 
 	List<Account> getNoAppleOneAccount(String appleOne);
 
 	List<OrderDon> getNoAppleOneOrderDon(List<Long> skuIds, Date yesZeroDate, Date thisZeroDate, List<String> noOrderStatus);
 
-	List<ExcelAccountData> getExpiredAccountViewNoPage(Boolean isCorpWx, String customerService, Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, String startDate, String endDate, String toString);
+	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);
 }

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

@@ -27,13 +27,13 @@ public class CmsAccountServiceImpl extends ServiceImpl<AccountMapper, Account> i
 	private final AccountMapper accountMapper;
 
 	@Override
-	public IPage<ExpiredAccountDataView> getExpiredAccountView(Boolean isCorpWx, String customerService, Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, String startTime, String endTime, String now, Long offset, Long limit) {
-		return accountMapper.getExpiredAccountView(isCorpWx, customerService, goodsId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime, now, new Page<>(offset, limit));
+	public IPage<ExpiredAccountDataView> getExpiredAccountView(Boolean isCorpWx, String customerService, Long goodsId, Long skuId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, String startTime, String endTime, String now, Long offset, Long limit) {
+		return accountMapper.getExpiredAccountView(isCorpWx, customerService, goodsId, skuId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime, now, new Page<>(offset, limit));
 	}
 
 	@Override
-	public List<ExcelAccountData> getExpiredAccountViewNoPage(Boolean isCorpWx, String customerService, Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, String startTime, String endTime, String now) {
-		return accountMapper.getExpiredAccountViewNoPage(isCorpWx, customerService, goodsId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime, now);
+	public List<ExcelAccountData> getExpiredAccountViewNoPage(Boolean isCorpWx, String customerService, Long goodsId, Long skuId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, String startTime, String endTime, String now) {
+		return accountMapper.getExpiredAccountViewNoPage(isCorpWx, customerService, goodsId, skuId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime, now);
 	}
 
 	@Override

+ 8 - 4
netflix-service/src/main/java/com/cyksj/service/mange/statistics/StatisticsDataService.java

@@ -6,6 +6,7 @@ import com.cyksj.model.excel.ExcelAccountData;
 import com.cyksj.model.views.BackgroundDataView;
 import com.cyksj.model.views.ExpiredAccountDataView;
 
+import java.util.Date;
 import java.util.List;
 
 /*
@@ -17,13 +18,16 @@ import java.util.List;
 public interface StatisticsDataService {
 	Result<BackgroundDataView> getStatisticsByCondition(Integer type, Long startTime, Long endTime);
 
-	IPage<ExpiredAccountDataView> getExpiredAccountView(Boolean isCorpWx, String customerService, Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer uid, Long startTime, Long endTime, Long start, Long limit);
+	IPage<ExpiredAccountDataView> getExpiredAccountView(Boolean isCorpWx, String customerService, Long goodsId, Long skuId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer uid, Long startTime, Long endTime, Long start, Long limit);
 
-	Result<String> updateRenewStatus(Integer relationId);
+	Result<String> updateRenewStatus(Long relationId);
 
-	Result<String> updateHandleStatus(Integer relationId);
+	Result<String> updateHandleStatus(Long relationId);
 
-	List<ExcelAccountData> getExpiredAccountViewNoPage(Boolean isCorpWx, String customerService, Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime);
+	List<ExcelAccountData> getExpiredAccountViewNoPage(Boolean isCorpWx, String customerService, Long goodsId, Long skuId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime);
 
 	BackgroundDataView getTitleData();
+
+	//分销金额数据统计
+	void distribute(BackgroundDataView backgroundDataView, Date startDate, Date endDate);
 }

+ 40 - 23
netflix-service/src/main/java/com/cyksj/service/mange/statistics/impl/StatisticsDataServiceImpl.java

@@ -18,6 +18,7 @@ import com.cyksj.mapper.manage.statistics.StreamingAccountDataMapper;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.excel.ExcelAccountData;
 import com.cyksj.model.manage.views.GroupsRelationView;
+import com.cyksj.model.manage.views.OrderDonView;
 import com.cyksj.model.views.*;
 import com.cyksj.service.mange.CmsAccountService;
 import com.cyksj.service.mange.statistics.StatisticsDataService;
@@ -84,6 +85,8 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 			case 1:
 				//流媒体账号
 				getStreamingAccountDataView(backgroundDataView, startDate, endDate);
+				//appleOne
+				getAppleOneDataView(backgroundDataView, startDate, endDate);
 				break;
 			case 2:
 				//实物数据
@@ -135,7 +138,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 	 * 注册账号数据
 	 */
 	private void getRegisterAccountData(BackgroundDataView backgroundDataView, Date startDate, Date endDate) {
-		if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(),1)).equals(endDate)) {
+		if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(), 1)).equals(endDate)) {
 			List<RegisterAccountData> registerAccountData = statistics.statisticsRegisterAccountData(startDate, endDate, true);
 			List<RegisterAccountData> collect = registerAccountData.stream().filter(data -> {
 				if (data.getNumOfUser() != null && data.getNumOfUser() > 0) {
@@ -146,14 +149,14 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 				return false;
 			}).collect(Collectors.toList());
 			backgroundDataView.setRegisterAccountDataViews(collect);
-		}else {
+		} else {
 			List<RegisterAccountData> registerAccountData = realGoodsDataMapper.statisticsRegisterAccountData(startDate, endDate);
 			backgroundDataView.setRegisterAccountDataViews(registerAccountData);
 		}
 	}
 
 	@Override
-	public IPage<ExpiredAccountDataView> getExpiredAccountView(Boolean isCorpWx, String customerService, Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime, Long start, Long limit) {
+	public IPage<ExpiredAccountDataView> getExpiredAccountView(Boolean isCorpWx, String customerService, Long goodsId, Long skuId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime, Long start, Long limit) {
 		String startDate = null;
 		String endDate = null;
 		if (startTime != null) {
@@ -162,12 +165,12 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		if (endTime != null) {
 			endDate = DateTime.of(endTime).toString();
 		}
-		IPage<ExpiredAccountDataView> expiredAccountDataViews = accountService.getExpiredAccountView(isCorpWx, customerService, goodsId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startDate, endDate, DateTime.now().toString(), start, limit);
+		IPage<ExpiredAccountDataView> expiredAccountDataViews = accountService.getExpiredAccountView(isCorpWx, customerService, goodsId, skuId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startDate, endDate, DateTime.now().toString(), start, limit);
 		return expiredAccountDataViews;
 	}
 
 	@Override
-	public List<ExcelAccountData> getExpiredAccountViewNoPage(Boolean isCorpWx, String customerService, Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime) {
+	public List<ExcelAccountData> getExpiredAccountViewNoPage(Boolean isCorpWx, String customerService, Long goodsId, Long skuId, 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) {
@@ -176,7 +179,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		if (endTime != null) {
 			endDate = DateTime.of(endTime).toString();
 		}
-		List<ExcelAccountData> expiredAccountDataViews = accountService.getExpiredAccountViewNoPage(isCorpWx, customerService, goodsId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startDate, endDate, DateTime.now().toString());
+		List<ExcelAccountData> expiredAccountDataViews = accountService.getExpiredAccountViewNoPage(isCorpWx, customerService, goodsId, skuId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startDate, endDate, DateTime.now().toString());
 		return expiredAccountDataViews;
 	}
 
@@ -185,11 +188,11 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		BackgroundDataView backgroundDataView = new BackgroundDataView();
 		Number waitingRegisterNum = beanSearcher.searchCount(RegisterOrderDon.class, MapUtils.builder()
 				.field(RegisterOrderDon::getStatus, RegisterOrderDon.Status.hasPayment.name()).op(Operator.Equal)
-				.onlySelect(RegisterOrderDon ::getId).build());
+				.onlySelect(RegisterOrderDon::getId).build());
 		backgroundDataView.setWaitingRegisterNum(waitingRegisterNum.intValue());
 		Number errorRegisterNum = beanSearcher.searchCount(RegisterOrderDon.class, MapUtils.builder()
 				.field(RegisterOrderDon::getStatus, RegisterOrderDon.Status.error.name()).op(Operator.Equal)
-				.onlySelect(RegisterOrderDon ::getId)
+				.onlySelect(RegisterOrderDon::getId)
 				.build());
 		backgroundDataView.setFailRegisterNum(errorRegisterNum.intValue());
 
@@ -212,11 +215,15 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 
 		Integer numOfMonthEmptyTripsNetflix = groupsMapper.selectEmptyNetfilxTrips(skuId);
 		backgroundDataView.setNumOfMonthEmptyTripsNetflix(numOfMonthEmptyTripsNetflix);
+		Number number = beanSearcher.searchCount(OrderDonView.class, MapUtils.builder().field(OrderDonView::getType, Constant.realGoodsType).op(Operator.InList)
+				.field(OrderDonView::getStatus, OrderDon.Status.hasPayment.name())
+				.build());
+		backgroundDataView.setWaitingSendRealOrder(number.intValue());
 		return backgroundDataView;
 	}
 
 	@Override
-	public Result<String> updateRenewStatus(Integer relationId) {
+	public Result<String> updateRenewStatus(Long relationId) {
 		GroupsRelation groupsRelation = groupsRelationMapper.selectById(relationId);
 		groupsRelation.setRenewStatus(!groupsRelation.getRenewStatus());
 		groupsRelationMapper.updateById(groupsRelation);
@@ -224,7 +231,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 	}
 
 	@Override
-	public Result<String> updateHandleStatus(Integer relationId) {
+	public Result<String> updateHandleStatus(Long relationId) {
 		GroupsRelation groupsRelation = groupsRelationMapper.selectById(relationId);
 		groupsRelation.setIsHandle(!groupsRelation.getIsHandle());
 		groupsRelationMapper.updateById(groupsRelation);
@@ -233,24 +240,25 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 
 	private void getAppleOneDataView(BackgroundDataView backgroundDataView, Date startDate, Date endDate) {
 		List<AppleOneData> appleOneData = appleOneDataMapper.statisticsAppleOneData(startDate, endDate);
-		if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(),1)).equals(endDate)) {
+		if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(), 1)).equals(endDate)) {
 			List<AppleOneData> appleOneData1 = statistics.statisticsAppleOneData(startDate, endDate, true);
 			List<AppleOneData> collect = appleOneData1.stream().filter(data -> {
 				if (data.getNumOfUser() != null && data.getNumOfUser() > 0) {
 					data.setMoney(data.getMoney().divide(BigDecimal.valueOf(100)));
+					data.setRefundMoney(getAppleOneRefundMoneyByArea(data.getAreaName(), startDate, endDate));
 					data.setDistributeOrderMoney(data.getDistributeOrderMoney().divide(BigDecimal.valueOf(100)));
 					return true;
 				}
 				return false;
 			}).collect(Collectors.toList());
 			backgroundDataView.setAppleOneDataViews(collect);
-		}else {
+		} else {
 			backgroundDataView.setAppleOneDataViews(appleOneData);
 		}
 	}
 
 	private void getStreamingAccountDataView(BackgroundDataView backgroundDataView, Date startDate, Date endDate) {
-		if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(),1)).equals(endDate)) {
+		if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(), 1)).equals(endDate)) {
 			List<StreamingAccountData> streamingAccountData = statistics.statisticsStreamingAccountData(startDate, endDate, true);
 			List<StreamingAccountData> collect = streamingAccountData.stream().filter(data -> {
 				if (data.getNumOfUser() != null && data.getNumOfUser() > 0) {
@@ -261,9 +269,9 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 				return false;
 			}).collect(Collectors.toList());
 			backgroundDataView.setStreamAccountDataViews(collect);
-		}else {
+		} else {
 			List<StreamingAccountData> streamingAccountData = streamingAccountDataMapper.statisticsStreamingData(startDate, endDate);
-			Optional.ofNullable(streamingAccountData).ifPresent(list->list.forEach(data->{
+			Optional.ofNullable(streamingAccountData).ifPresent(list -> list.forEach(data -> {
 				GoodsDon goodsDon = goodsDonMapper.selectOne(Wrappers.lambdaQuery(GoodsDon.class).eq(GoodsDon::getId, data.getGoodsId()).last("limit 1"));
 				if (goodsDon != null) {
 					data.setAccountName(goodsDon.getTitle());
@@ -275,9 +283,9 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 	}
 
 	private void getRealGoodsData(BackgroundDataView backgroundDataView, Date startDate, Date endDate) {
-		if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(),1)).equals(endDate)) {
+		if (DateUtil.beginOfDay(DateTime.now()).equals(startDate) && DateUtil.beginOfDay(DateUtil.offsetDay(DateTime.now(), 1)).equals(endDate)) {
 			List<RealGoodsData> realGoodsData = statistics.statisticsRealGoodsData(startDate, endDate, true);
-			List<RealGoodsData> collect = realGoodsData.stream().filter(data ->{
+			List<RealGoodsData> collect = realGoodsData.stream().filter(data -> {
 				if (data.getNumOfUser() != null && data.getNumOfUser() > 0) {
 					data.setRefundMoney(getRefundMoney(data.getGoodsId(), startDate, endDate));
 					data.setMoney(data.getMoney().divide(BigDecimal.valueOf(100)));
@@ -286,7 +294,7 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 				return false;
 			}).collect(Collectors.toList());
 			backgroundDataView.setRealGoodsDataViews(collect);
-		}else {
+		} else {
 			List<RealGoodsData> realGoodsData = realGoodsDataMapper.statisticsRealGoodsData(startDate, endDate);
 			Optional.ofNullable(realGoodsData).ifPresent(list -> list.forEach(data -> {
 				GoodsDon goodsDon = goodsDonMapper.selectOne(Wrappers.lambdaQuery(GoodsDon.class).eq(GoodsDon::getId, data.getGoodsId()).last("limit 1"));
@@ -334,15 +342,14 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		setGoodsMoneyAndOrder(2, backgroundDataView);
 		//潮玩
 		setGoodsMoneyAndOrder(3, backgroundDataView);
-
-		//分销金额数据统计
-		distribute(backgroundDataView, startDate, endDate);
 	}
 
 	/**
 	 * 分销金额信息补充
+	 *
 	 * @param backgroundDataView
 	 */
+	@Override
 	public void distribute(BackgroundDataView backgroundDataView, Date startDate, Date endDate) {
 		List<DistributeOrdersView> distributeOrders = Optional.ofNullable(beanSearcher.searchAll(DistributeOrdersView.class, MapUtils.builder()
 				.field(DistributeOrdersView::getCreatedTime, startDate, endDate).op(Operator.Between)
@@ -350,13 +357,13 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 		backgroundDataView.setDistributeOrders(distributeOrders.size());
 		//固定推广者订单
 		List<DistributeOrdersView> distributePopularizeOrders = Optional.ofNullable(beanSearcher.searchAll(DistributeOrdersView.class, MapUtils.builder()
-				.field(DistributeOrdersView::getIsFixedDistribute,true).op(Operator.Equal)
+				.field(DistributeOrdersView::getIsFixedDistribute, true).op(Operator.Equal)
 				.field(DistributeOrdersView::getCreatedTime, startDate, endDate).op(Operator.Between)
 				.build())).orElse(new ArrayList<>());
 		backgroundDataView.setDistributePopularizeOrders(distributePopularizeOrders.size());
 		//普通分销单数
 		List<DistributeOrdersView> distributeOriginalOrders = Optional.ofNullable(beanSearcher.searchAll(DistributeOrdersView.class, MapUtils.builder()
-				.field(DistributeOrdersView::getIsFixedDistribute,false).op(Operator.Equal)
+				.field(DistributeOrdersView::getIsFixedDistribute, false).op(Operator.Equal)
 				.field(DistributeOrdersView::getCreatedTime, startDate, endDate).op(Operator.Between)
 				.build())).orElse(new ArrayList<>());
 		backgroundDataView.setDistributeOriginalOrders(distributeOriginalOrders.size());
@@ -422,4 +429,14 @@ public class StatisticsDataServiceImpl implements StatisticsDataService {
 			backgroundDataView.setFashionAccountOfOrder(orderMoney);
 		}
 	}
+
+	private BigDecimal getAppleOneRefundMoneyByArea(String areaName, Date startDate, Date endDate) {
+		Number refundMoneyNumber = beanSearcher.searchSum(OrderDonView.class, MapUtils.builder()
+				.field(OrderDonView::getSpecVal, areaName).op(Operator.Contain)
+				.field(OrderDon::getStatus, OrderDon.Status.refund.name())
+				.field(OrderDon::getCreatedTime, startDate, endDate).op(Operator.Between)
+				.build(), "refundMoney");
+		BigDecimal refundMoney = BigDecimal.valueOf(refundMoneyNumber.intValue()).divide(BigDecimal.valueOf(100));
+		return refundMoney;
+	}
 }

+ 20 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsOrderController.java

@@ -15,6 +15,7 @@ import com.cyksj.mapper.manage.RealGoodsOrderHandleMapper;
 import com.cyksj.mapper.manage.coupon.CouponMapper;
 import com.cyksj.model.entity.*;
 import com.cyksj.model.excel.ExcelOrderDonData;
+import com.cyksj.model.excel.ExcelRealGoodsOrderData;
 import com.cyksj.model.excel.ExcelRealGoodsUserInterestData;
 import com.cyksj.model.excel.ExcelRealGoodsUserInterestHasPaymentData;
 import com.cyksj.model.manage.request.ReqSetLogisticsPost;
@@ -135,6 +136,25 @@ public class CmsOrderController {
 		EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelOrderDonData.class, list, "订单列表", "订单列表", ExcelTypeEnum.XLSX, null);
 	}
 
+	/**
+	 * 导出实物模板 订单excel
+	 */
+	@GetMapping("/export/realGoods")
+	public void exportRealGoods(HttpServletResponse response) {
+		List<ExcelRealGoodsOrderData> list = beanSearcher.searchAll(ExcelRealGoodsOrderData.class, MapUtils.flatBuilder(request.getParameterMap())
+				.field(ExcelOrderDonData::getType, Constant.realGoodsType).op(Operator.InList)
+				.build());
+		list.forEach(data -> {
+			data.setPayType("寄付现结");
+			if (data.getGoodsDonType() == Constant.realGoodsType.get(0)) {
+				data.setRealGoodName("路由器");
+			} else if (data.getGoodsDonType() == Constant.realGoodsType.get(1)) {
+				data.setRealGoodName("银河潮玩");
+			}
+		});
+		EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelOrderDonData.class, list, "实物订单列表", "实物订单列表", ExcelTypeEnum.XLSX, null);
+	}
+
 	@PutMapping("/update/status")
     public Result<String> upStatus(@RequestBody OrderDon orderDon){
         cmsOrderDonService.update(Wrappers.lambdaUpdate(OrderDon.class).eq(OrderDon::getId,orderDon.getId()).set(OrderDon::getStatus,orderDon.getStatus()));

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

@@ -14,13 +14,14 @@ import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
 import com.cyksj.mapper.GroupsMapper;
 import com.cyksj.mapper.HomeGroupMapper;
-import com.cyksj.model.entity.Account;
-import com.cyksj.model.entity.GroupsTrips;
-import com.cyksj.model.entity.HomeGroup;
+import com.cyksj.mapper.UserTicketClearedRecordMapper;
+import com.cyksj.model.entity.*;
 import com.cyksj.model.excel.ExcelAccountTemplateData;
 import com.cyksj.model.excel.ExcelManageAccountData;
 import com.cyksj.model.manage.request.ReqAccountIncrExpiryTime;
 import com.cyksj.model.manage.views.AccountView;
+import com.cyksj.model.manage.views.GroupsRelationView;
+import com.cyksj.model.views.UserTicketClearedRecordView;
 import com.cyksj.service.mange.CmsAccountService;
 import com.cyksj.service.mange.CmsGroupService;
 import com.cyksj.service.template.TemplateCommonService;
@@ -66,6 +67,8 @@ public class CmsAccountController {
 
 	private final CmsGroupService cmsGroupService;
 
+	private final UserTicketClearedRecordMapper userTicketClearedRecordMapper;
+
     @GetMapping("/get")
     public Result<SearchResult<AccountView>> get(Long userId ,String nickName ,String submitAccount ,String expiryStartTime, String expiryEndTime) {
         MapBuilder mapBuilder = MapUtils.flatBuilder(request.getParameterMap());
@@ -155,6 +158,10 @@ public class CmsAccountController {
 						}
 						if (flag) {
 							accountService.updateById(account);
+							//清空过期账号 逻辑删除
+							userTicketClearedRecordMapper.update(null, Wrappers.lambdaUpdate(UserTicketClearedRecord.class)
+									.set(UserTicketClearedRecord::getDeleted, false)
+									.eq(UserTicketClearedRecord::getAccountId, account.getId()));
 						}
 					}
 				}
@@ -204,7 +211,53 @@ public class CmsAccountController {
         return GatewayResponse.SUCCESS.newBuilder().toResult();
     }
 
-    @DeleteMapping("/delete/{id}")
+	/**
+	 * 修改密码并发送模板消息
+	 */
+	@PutMapping("/update/pwd")
+	public Result<String> updatePwdAndSendMsg(@RequestBody List<Account> accounts) throws Exception {
+		accounts.forEach(account -> {
+			Account db = accountService.getById(account.getId());
+			String updatePWd = account.getPassword().trim();
+			if (!db.getPassword().equals(updatePWd)) {
+				db.setPassword(updatePWd);
+				accountService.updateById(db);
+				//清空过期账号 逻辑删除
+				userTicketClearedRecordMapper.update(null, Wrappers.lambdaUpdate(UserTicketClearedRecord.class)
+						.set(UserTicketClearedRecord::getDeleted, false)
+						.eq(UserTicketClearedRecord::getAccountId, account.getId()));
+				//发放模板消息
+				try {
+					templateCommonService.sendAccountTemplateMsg(account);
+				} catch (Exception e) {
+					log.error("发送账号{}修改密码消息模板错误", account.getId());
+				}
+			}
+		});
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
+
+	/**
+	 * 账号已过期车票列表
+	 */
+	@GetMapping("/get/expired/ticket")
+	public Result<SearchResult<UserTicketClearedRecordView>> getUserHadExpiredTicket() {
+		SearchResult<UserTicketClearedRecordView> search = beanSearcher.search(UserTicketClearedRecordView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
+		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
+	}
+
+	/**
+	 * 账号未过期车票列表
+	 */
+	@GetMapping("/get/valid/ticket")
+	public Result<SearchResult<GroupsRelationView>> getValidTicket() {
+		SearchResult<GroupsRelationView> search = beanSearcher.search(GroupsRelationView.class, MapUtils.flatBuilder(request.getParameterMap())
+				.field(GroupsRelationView::getStatus, GroupsRelation.Status.validity.name()).build());
+		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
+	}
+
+
+	@DeleteMapping("/delete/{id}")
     public Result<String> update(@PathVariable Long id){
 	    //是否关联了车队
 	    Integer count = groupsMapper.selectCount(Wrappers.lambdaQuery(GroupsTrips.class).eq(GroupsTrips::getAccountId, id));

+ 24 - 3
netflix-web/src/main/java/com/cyksj/web/controller/manage/distribute/DistributeController.java

@@ -1,5 +1,6 @@
 package com.cyksj.web.controller.manage.distribute;
 
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.cyksj.common.constant.Constant;
@@ -8,7 +9,6 @@ import com.cyksj.dto.Result;
 import com.cyksj.enums.GatewayResponse;
 import com.cyksj.mapper.GoodsDonMapper;
 import com.cyksj.mapper.GoodsDonSkuMapper;
-import com.cyksj.mapper.OrderDonMapper;
 import com.cyksj.mapper.UserMapper;
 import com.cyksj.mapper.manage.distribute.DistributeMoneyApplyMapper;
 import com.cyksj.mapper.manage.distribute.DistributePointsExchangeMoneyMapper;
@@ -18,6 +18,7 @@ import com.cyksj.model.request.DistributeApplyMoneyReq;
 import com.cyksj.model.request.UserDistributeReq;
 import com.cyksj.model.views.*;
 import com.cyksj.service.distribute.DistributeService;
+import com.cyksj.service.mange.statistics.StatisticsDataService;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.SearchResult;
 import com.ejlchina.searcher.param.Operator;
@@ -31,6 +32,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.validation.constraints.NotNull;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.util.Date;
 import java.util.List;
 import java.util.Optional;
 
@@ -52,8 +54,6 @@ public class DistributeController {
 
 	private final BeanSearcher beanSearcher;
 
-	private final OrderDonMapper orderDonMapper;
-
 	private final DistributeMoneyApplyMapper distributeMoneyApplyMapper;
 
 	private final DistributePointsExchangeMoneyMapper distributePointsExchangeMoneyMapper;
@@ -66,6 +66,8 @@ public class DistributeController {
 
 	private final HttpServletRequest request;
 
+	private final StatisticsDataService statisticsDataService;
+
 	/**
 	 * 添加固定推广者
 	 */
@@ -288,4 +290,23 @@ public class DistributeController {
 		distributeMoneyApplyMapper.updateById(apply);
 		return GatewayResponse.SUCCESS.newBuilder().toResult("编辑成功");
 	}
+
+	/**
+	 * 获取分销head
+	 */
+	@GetMapping("/get/headData")
+	public Result<BackgroundDataView> getDistributeHeadData(Long startTime, Long endTime) {
+		BackgroundDataView backgroundDataView = new BackgroundDataView();
+		Date startDate = null;
+		Date endDate = null;
+		if (startTime != null) {
+			startDate = DateUtil.date(startTime);
+		}
+		if (endTime != null) {
+			endDate = DateUtil.date(endTime);
+		}
+		//分销金额数据统计
+		statisticsDataService.distribute(backgroundDataView, startDate, endDate);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(backgroundDataView);
+	}
 }

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

@@ -93,25 +93,16 @@ public class StatisticsDataController {
 	 * 有效子账号数列表
 	 */
 	@GetMapping("/expired/account")
-	public Result<IPage<ExpiredAccountDataView>> getExpiredAccountView(Boolean isCorpWx, String customerService, Integer goodsId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime, @RequestParam(required = false, defaultValue = "1") Long start, @RequestParam(required = false, defaultValue = "10") Long limit) {
-		return GatewayResponse.SUCCESS.newBuilder().toResult(statisticsDataService.getExpiredAccountView(isCorpWx, customerService, goodsId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime, start, limit));
-	}
-
-	/**
-	 * 已过期车票
-	 */
-	@GetMapping("/get/hadExpired/account")
-	public Result<SearchResult<UserTicketClearedRecordView>> getUserHadExpiredTicket() {
-		SearchResult<UserTicketClearedRecordView> search = beanSearcher.search(UserTicketClearedRecordView.class, MapUtils.flatBuilder(request.getParameterMap()).build());
-		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
+	public Result<IPage<ExpiredAccountDataView>> getExpiredAccountView(Boolean isCorpWx, String customerService, Long goodsId, Long skuId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime, @RequestParam(required = false, defaultValue = "1") Long start, @RequestParam(required = false, defaultValue = "10") Long limit) {
+		return GatewayResponse.SUCCESS.newBuilder().toResult(statisticsDataService.getExpiredAccountView(isCorpWx, customerService, goodsId, skuId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime, start, limit));
 	}
 
 	/**
 	 * 导出有效子账号数
 	 */
 	@GetMapping("/export/account")
-	public void exportAccount(Boolean isCorpWx, String customerService, 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(isCorpWx, customerService, goodsId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime);
+	public void exportAccount(Boolean isCorpWx, String customerService, Long goodsId, Long skuId, String account, Boolean renewStatus, Boolean handleStatus, String cnAccount, String usAccount, Integer userId, Long startTime, Long endTime, HttpServletResponse response) {
+		List<ExcelAccountData> expiredAccountView = statisticsDataService.getExpiredAccountViewNoPage(isCorpWx, customerService, goodsId, skuId, account, renewStatus, handleStatus, cnAccount, usAccount, userId, startTime, endTime);
 		EasyExcelUtils.createExcelStreamMutilByEasyExcel(response, ExcelAccountData.class, expiredAccountView, "有效子账号", "有效子账号", ExcelTypeEnum.XLSX, null);
 	}
 
@@ -119,7 +110,7 @@ public class StatisticsDataController {
 	 * 到期状态续费意愿修改
 	 */
 	@PutMapping("/put/renewStatus/{relationId}")
-	public Result<String> updateRenewStatus(@PathVariable Integer relationId) {
+	public Result<String> updateRenewStatus(@PathVariable Long relationId) {
 		if (relationId == null || relationId < 1) {
 			throw BusinessRuntimeException.getInstance("用户关联组id不存在");
 		}
@@ -130,7 +121,7 @@ public class StatisticsDataController {
 	 * 处理状态修改
 	 */
 	@PutMapping("/put/handleStatus/{relationId}")
-	public Result<String> updateHandleStatus(@PathVariable Integer relationId) {
+	public Result<String> updateHandleStatus(@PathVariable Long relationId) {
 		if (relationId == null || relationId < 1) {
 			throw BusinessRuntimeException.getInstance("用户关联组id不存在");
 		}