From c113e8b7e11a52bf1eeaf1ced7324db7ee4305fa Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期三, 24 六月 2020 09:36:22 +0800
Subject: [PATCH] 发圈零点关键词调整
---
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgMoneyDetailFactory.java | 517 ++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 360 insertions(+), 157 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgMoneyDetailFactory.java b/fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgMoneyDetailFactory.java
index 80548c8..82bba94 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgMoneyDetailFactory.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgMoneyDetailFactory.java
@@ -1,85 +1,76 @@
package com.yeshi.fanli.util.factory.msg;
import java.math.BigDecimal;
+import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
+import org.yeshi.utils.StringUtil;
+
+import com.google.gson.Gson;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
import com.yeshi.fanli.entity.bus.user.Extract;
import com.yeshi.fanli.entity.bus.user.UserInfo;
-import com.yeshi.fanli.util.MoneyBigDecimalUtil;
+import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.TimeUtil;
+import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
+import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
+import com.yeshi.fanli.vo.msg.CommonMsgItemVOFactory;
public class MsgMoneyDetailFactory {
-
+
/**
- * 鎻愮幇鐢宠娑堟伅
+ * 璐﹀彿楠岃瘉娑堟伅
*
- * @param extract
+ * @param valid
* @param uid
* @param beiZhu
* @return
*/
- public static MsgMoneyDetail createExtractApplyMsg(Extract extract, Long uid, String beiZhu) {
+ public static MsgMoneyDetail createExtractMsg(String stateDesc, Long uid, Extract extract, String reason,
+ String alipayNo, String beizu) {
if (extract == null || uid == null)
return null;
+
+ String name = filterName(extract.getName());
+ String account = filterAccount(extract.getAccount());
+
+ List<CommonMsgItemVO> listMsg = new ArrayList<>();
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鎻愮幇璐﹀彿", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(String.format("鏀粯瀹�:%s-濮撳悕:%s",account, name), ClientTextStyleVO.COLOR_CONTENT)));
+
+ List<ClientTextStyleVO> contentList = new ArrayList<>();
+ contentList.add(new ClientTextStyleVO("楼" + extract.getMoney().setScale(2, BigDecimal.ROUND_DOWN), ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
+ if (!StringUtil.isNullOrEmpty(alipayNo)) {
+ contentList.add(new ClientTextStyleVO(String.format("&鏀粯瀹濊鍗曞彿: %s", "*" + alipayNo.substring(alipayNo.length() - 10)), ClientTextStyleVO.COLOR_CONTENT));
+ }
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鎻愮幇閲戦", ClientTextStyleVO.COLOR_TITLE),contentList));
+
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鎻愮幇鐘舵��", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(stateDesc, ClientTextStyleVO.COLOR_CONTENT)));
+
+ if (!StringUtil.isNullOrEmpty(reason)) {
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鍘熷洜", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(reason, ClientTextStyleVO.COLOR_CONTENT)));
+ }
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("澶囨敞", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(beizu, ClientTextStyleVO.COLOR_CONTENT)));
+
MsgMoneyDetail detail = new MsgMoneyDetail();
- detail.setBeiZhu(beiZhu);
+ detail.setBeiZhu(reason);
detail.setCreateTime(new Date());
detail.setExtract(extract);
detail.setMoney(extract.getMoney());
detail.setMsgType(MsgTypeMoneyTypeEnum.extract);
detail.setRead(false);
detail.setUser(new UserInfo(uid));
- detail.setStateDesc("浜哄伐瀹℃牳涓�");
+ detail.setStateDesc(stateDesc);
+ detail.setExtraInfo(new Gson().toJson(listMsg));
return detail;
}
- /**
- * 鎻愮幇鎴愬姛娑堟伅
- *
- * @param extract
- * @param uid
- * @param beiZhu
- * @return
- */
- public static MsgMoneyDetail createExtractSuccessMsg(Extract extract, Long uid, String beiZhu) {
- if (extract == null || uid == null)
- return null;
- MsgMoneyDetail detail = new MsgMoneyDetail();
- detail.setBeiZhu(beiZhu);
- detail.setCreateTime(new Date());
- detail.setExtract(extract);
- detail.setMoney(extract.getMoney());
- detail.setMsgType(MsgTypeMoneyTypeEnum.extract);
- detail.setRead(false);
- detail.setUser(new UserInfo(uid));
- detail.setStateDesc("鎻愮幇鎴愬姛");
- return detail;
- }
-
- /**
- * 鎻愮幇澶辫触娑堟伅
- *
- * @param extract
- * @param uid
- * @param beiZhu
- * @return
- */
- public static MsgMoneyDetail createExtractFailMsg(Extract extract, Long uid, String beiZhu) {
- if (extract == null || uid == null)
- return null;
- MsgMoneyDetail detail = new MsgMoneyDetail();
- detail.setBeiZhu(beiZhu);
- detail.setCreateTime(new Date());
- detail.setExtract(extract);
- detail.setMoney(extract.getMoney());
- detail.setMsgType(MsgTypeMoneyTypeEnum.extract);
- detail.setRead(false);
- detail.setUser(new UserInfo(uid));
- detail.setStateDesc("鎻愮幇澶辫触");
- return detail;
- }
/**
* 璐﹀彿楠岃瘉娑堟伅
@@ -90,22 +81,99 @@
* @return
*/
public static MsgMoneyDetail createAlipayAccountValidMsg(AlipayAccountValidNormalHistory valid, Long uid,
- String company, BigDecimal money, String beiZhu) {
- if (valid == null || uid == null || company == null)
+ String appName, BigDecimal money, String limitDay, boolean change) {
+ if (valid == null || uid == null || appName == null)
return null;
+
+ String changeWay = "缁戝畾";
+ if (change) {
+ changeWay = "淇敼";
+ }
+ String name = filterName(valid.getName());
+ String account = filterAccount(valid.getAccount());
+
+ List<CommonMsgItemVO> listMsg = new ArrayList<>();
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("楠岃瘉鐘舵��", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(String.format("鎻愮幇璐﹀彿%s鎴愬姛", changeWay), ClientTextStyleVO.COLOR_CONTENT)));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鎻愮幇璐﹀彿", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(String.format("鏀粯瀹�:%s-濮撳悕:%s",account, name), ClientTextStyleVO.COLOR_CONTENT)));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鎵撴閲戦", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO("楼" + money.setScale(2, BigDecimal.ROUND_DOWN), ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT)));
+
+ List<ClientTextStyleVO> contentList2 = new ArrayList<>();
+ contentList2.add(new ClientTextStyleVO("鎻愮幇璐﹀彿鏀跺埌涓�绗旓紝鏉ヨ嚜", ClientTextStyleVO.COLOR_CONTENT));
+ contentList2.add(new ClientTextStyleVO(appName, ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
+ contentList2.add(new ClientTextStyleVO("鐨勮浆璐︼紝鍗崇粦瀹氭垚鍔�", ClientTextStyleVO.COLOR_CONTENT));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("璇存槑", ClientTextStyleVO.COLOR_TITLE),contentList2));
+
+ List<ClientTextStyleVO> contentList = new ArrayList<>();
+ contentList.add(new ClientTextStyleVO(String.format("鎴愬姛%s鐨勬彁鐜拌处鍙�", changeWay), ClientTextStyleVO.COLOR_CONTENT));
+ contentList.add(new ClientTextStyleVO( limitDay+"", ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
+ contentList.add(new ClientTextStyleVO("鍐呮棤娉曚慨鏀�", ClientTextStyleVO.COLOR_CONTENT));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("澶囨敞", ClientTextStyleVO.COLOR_TITLE),contentList));
+
+
MsgMoneyDetail detail = new MsgMoneyDetail();
detail.setAlipayAccountValid(valid);
- detail.setBeiZhu(beiZhu);
detail.setCreateTime(new Date());
detail.setMoney(money);
- detail.setStateDesc(String
- .format("宸插悜浣犵殑鎻愮幇鏀粯瀹濊浆鍏ヤ竴绗旀潵鑷簬鈥�%s鈥濇�婚涓�%s鍏冪殑杞处锛屾敹鍒板嵆鎻愮幇甯愬彿楠岃瘉鎴愬姛銆�", company, MoneyBigDecimalUtil.getWithNoZera(money))
- .toString());
detail.setMsgType(MsgTypeMoneyTypeEnum.extractValid);
detail.setRead(false);
detail.setUser(new UserInfo(uid));
+ detail.setExtraInfo(new Gson().toJson(listMsg));
return detail;
}
+
+
+ /**
+ * 璐﹀彿楠岃瘉娑堟伅
+ *
+ * @param valid
+ * @param uid
+ * @param beiZhu
+ * @return
+ */
+ public static MsgMoneyDetail createAlipayAccountValidFail(AlipayAccountValidNormalHistory valid, Long uid,
+ String appName, BigDecimal money, int limitDay, boolean change) {
+ if (valid == null || uid == null || appName == null)
+ return null;
+
+ String changeWay = "缁戝畾";
+ if (change) {
+ changeWay = "淇敼";
+ }
+
+ List<CommonMsgItemVO> listMsg = new ArrayList<>();
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("楠岃瘉鐘舵��", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(String.format("鎻愮幇璐﹀彿%s澶辫触", changeWay), ClientTextStyleVO.COLOR_CONTENT)));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鎻愮幇璐﹀彿", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(String.format("鏀粯瀹�:%s-濮撳悕:%s",valid.getAccount(), valid.getName()), ClientTextStyleVO.COLOR_CONTENT)));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鍘熷洜", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO("璇蜂粩缁嗘牳瀵瑰~鍐欒处鍙锋槸鍚︽湁璇垨璺濅笂涓�娆′慨鏀规椂闀挎槸鍚﹁秴杩�30澶�", ClientTextStyleVO.COLOR_CONTENT)));
+
+ if (!change) {
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("澶囨敞", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO("鏃�", ClientTextStyleVO.COLOR_CONTENT)));
+ } else {
+ List<ClientTextStyleVO> contentList = new ArrayList<>();
+ contentList.add(new ClientTextStyleVO("璺濅笅涓�娆′慨鏀规椂闂磋繕鏈�", ClientTextStyleVO.COLOR_CONTENT));
+ contentList.add(new ClientTextStyleVO(limitDay+"", ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
+ contentList.add(new ClientTextStyleVO("澶╁唴鏃犳硶淇敼", ClientTextStyleVO.COLOR_CONTENT));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("澶囨敞", ClientTextStyleVO.COLOR_TITLE),contentList));
+ }
+
+ MsgMoneyDetail detail = new MsgMoneyDetail();
+ detail.setAlipayAccountValid(valid);
+ detail.setCreateTime(new Date());
+ detail.setMoney(money);
+ detail.setMsgType(MsgTypeMoneyTypeEnum.extractValid);
+ detail.setRead(false);
+ detail.setUser(new UserInfo(uid));
+ detail.setExtraInfo(new Gson().toJson(listMsg));
+ return detail;
+ }
+
+
/**
* 杩斿埄鍒拌处
@@ -118,25 +186,108 @@
* @param beiZhu
* @return
*/
- public static MsgMoneyDetail createFailiMsg(BigDecimal money, BigDecimal balance, String orderId, int goodsCount,
- Long uid, String beiZhu) {
+ public static MsgMoneyDetail fanLiOrderReceivedMsg(BigDecimal money, BigDecimal balance, String orderId, int source,
+ int goodsCount, Long uid, Date downTime, boolean useCoupon) {
if (money == null || balance == null || orderId == null || uid == null)
return null;
+ String fanliName = "鑷喘杩斿埄";
+ String sourceName = Constant.getSourceName(source) + "-杩斿埄璁㈠崟";
+ if (useCoupon) {
+ fanliName = "浣跨敤杩斿埄濂栧姳鍒�";
+ }
+
+ List<CommonMsgItemVO> listMsg = new ArrayList<>();
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鍒拌处璇︽儏", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(sourceName, ClientTextStyleVO.COLOR_CONTENT)));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("璁㈠崟鍙�", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(orderId, ClientTextStyleVO.COLOR_CONTENT)));
+
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("涓嬪崟鏃堕棿", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(TimeUtil.formatDate(downTime), ClientTextStyleVO.COLOR_CONTENT)));
+
+ List<ClientTextStyleVO> contentList = new ArrayList<>();
+ contentList.add(new ClientTextStyleVO("鍏�", ClientTextStyleVO.COLOR_CONTENT));
+ contentList.add(new ClientTextStyleVO(goodsCount + "", ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
+ contentList.add(new ClientTextStyleVO("浠跺晢鍝�", ClientTextStyleVO.COLOR_CONTENT));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鍟嗗搧鏁伴噺", ClientTextStyleVO.COLOR_TITLE), contentList));
+
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鍒拌处绫荤洰", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(fanliName, ClientTextStyleVO.COLOR_CONTENT)));
+
+ List<ClientTextStyleVO> contentList2 = new ArrayList<>();
+ contentList2.add(new ClientTextStyleVO("楼" + money.setScale(2, BigDecimal.ROUND_DOWN), ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
+ contentList2.add(new ClientTextStyleVO("锛堣处鎴蜂綑棰澛�"+ balance.setScale(2, BigDecimal.ROUND_DOWN) + "锛�", ClientTextStyleVO.COLOR_CONTENT));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鍒拌处閲戦", ClientTextStyleVO.COLOR_TITLE), contentList2));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("澶囨敞", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO("濡傛湁鐤戦棶璇疯仈绯讳汉宸ュ鏈�", ClientTextStyleVO.COLOR_CONTENT)));
+
MsgMoneyDetail detail = new MsgMoneyDetail();
detail.setBalance(balance);
- detail.setBeiZhu(beiZhu);
detail.setCreateTime(new Date());
detail.setGoodsCount(goodsCount);
detail.setMoney(money);
detail.setMsgType(MsgTypeMoneyTypeEnum.fanli);
detail.setOrderId(orderId);
+ detail.setOrderType(source);
detail.setRead(false);
detail.setUser(new UserInfo(uid));
-
+ detail.setExtraInfo(new Gson().toJson(listMsg));
return detail;
}
+
+
+ /**
+ * 杩斿埄鍒拌处
+ *
+ * @param money
+ * @param balance
+ * @param orderId
+ * @param goodsCount
+ * @param uid
+ * @param beiZhu
+ * @return
+ */
+ public static MsgMoneyDetail shareOrderReceivedMsg(BigDecimal money, BigDecimal balance, int source, Long uid, Date receivedDate) {
+ if (money == null || balance == null || uid == null)
+ return null;
+
+ String sourceName = Constant.getSourceName(source) + "-鍒嗕韩璁㈠崟";
+ List<CommonMsgItemVO> listMsg = new ArrayList<>();
+
+ List<ClientTextStyleVO> contentList = new ArrayList<>();
+ contentList.add(new ClientTextStyleVO(TimeUtil.getYearOnlyYYYY(receivedDate)+ "骞�", ClientTextStyleVO.COLOR_CONTENT));
+ contentList.add(new ClientTextStyleVO(TimeUtil.getMonthOnlyMM(receivedDate), ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
+ contentList.add(new ClientTextStyleVO("鏈�", ClientTextStyleVO.COLOR_CONTENT));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("缁撶畻鏈堝害", ClientTextStyleVO.COLOR_TITLE), contentList));
+
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鍒拌处璇︽儏", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(sourceName, ClientTextStyleVO.COLOR_CONTENT)));
+
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鍒拌处绫荤洰", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO("鍒嗕韩濂栭噾", ClientTextStyleVO.COLOR_CONTENT)));
+
+ List<ClientTextStyleVO> contentList2 = new ArrayList<>();
+ contentList2.add(new ClientTextStyleVO("楼" + money.setScale(2, BigDecimal.ROUND_DOWN), ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
+ contentList2.add(new ClientTextStyleVO("锛堣处鎴蜂綑棰澛�"+ balance.setScale(2, BigDecimal.ROUND_DOWN) + "锛�", ClientTextStyleVO.COLOR_CONTENT));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鍒拌处閲戦", ClientTextStyleVO.COLOR_TITLE), contentList2));
+
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("澶囨敞", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO("濡傛湁鐤戦棶璇疯仈绯讳汉宸ュ鏈�", ClientTextStyleVO.COLOR_CONTENT)));
+
+ MsgMoneyDetail detail = new MsgMoneyDetail();
+ detail.setBalance(balance);
+ detail.setCreateTime(new Date());
+ detail.setMoney(money);
+ detail.setMsgType(MsgTypeMoneyTypeEnum.share);
+ detail.setOrderType(source);
+ detail.setRead(false);
+ detail.setUser(new UserInfo(uid));
+ detail.setExtraInfo(new Gson().toJson(listMsg));
+ return detail;
+ }
+
/**
* 杩斿埄缁存潈
*
@@ -147,21 +298,65 @@
* @param beiZhu
* @return
*/
- public static MsgMoneyDetail createFailiWeiQuanMsg(Long uid, String orderId, BigDecimal money, BigDecimal balance,
- String beiZhu) {
+ public static MsgMoneyDetail createOrderWeiQuanMsg(Long uid, String orderId, int source, BigDecimal money,
+ BigDecimal fanliMoney, int goodsCount, Date downTime, int type) {
if (money == null || orderId == null || money == null || uid == null)
return null;
+
+ MsgTypeMoneyTypeEnum typeEnum = null;
+ String sourceName = Constant.getSourceName(source);
+ if (Constant.TYPE_REBATE == type) {
+ sourceName += "-杩斿埄璁㈠崟";
+ typeEnum = MsgTypeMoneyTypeEnum.fanliWeiQuan;
+ } else if (Constant.TYPE_SHAER == type) {
+ sourceName += "-鍒嗕韩璁㈠崟";
+ typeEnum = MsgTypeMoneyTypeEnum.shareWeiQuan;
+ }
+ String weiquan = "璁㈠崟鍞悗";
+ String weiquanMoney = "鍏ㄩ閫�鍥�";
+ if (fanliMoney.compareTo(money) > 0) {
+ weiquan = "璁㈠崟閮ㄥ垎鍞悗";
+ weiquan = "閮ㄥ垎閫�鍥�";
+ }
+
+ List<CommonMsgItemVO> listMsg = new ArrayList<>();
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("閫�鍥炶鎯�", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(sourceName, ClientTextStyleVO.COLOR_CONTENT)));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("璁㈠崟鍙�", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(orderId, ClientTextStyleVO.COLOR_CONTENT)));
+
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("涓嬪崟鏃堕棿", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(TimeUtil.formatDate(downTime), ClientTextStyleVO.COLOR_CONTENT)));
+
+ List<ClientTextStyleVO> contentList = new ArrayList<>();
+ contentList.add(new ClientTextStyleVO("鍏�", ClientTextStyleVO.COLOR_CONTENT));
+ contentList.add(new ClientTextStyleVO(goodsCount + "", ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
+ contentList.add(new ClientTextStyleVO("浠跺晢鍝�", ClientTextStyleVO.COLOR_CONTENT));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鍟嗗搧鏁伴噺", ClientTextStyleVO.COLOR_TITLE), contentList));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("閫�鍥炲師鍥�", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(weiquan, ClientTextStyleVO.COLOR_CONTENT)));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鍒拌处閲戦", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO("楼" +fanliMoney.setScale(2, BigDecimal.ROUND_DOWN) + "锛堝師鍒拌处閲戦锛�", ClientTextStyleVO.COLOR_CONTENT)));
+
+ List<ClientTextStyleVO> contentList2 = new ArrayList<>();
+ contentList2.add(new ClientTextStyleVO("楼" + money.setScale(2, BigDecimal.ROUND_DOWN), ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
+ contentList2.add(new ClientTextStyleVO("锛�"+ weiquanMoney + "锛�", ClientTextStyleVO.COLOR_CONTENT));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("閫�鍥為噾棰�", ClientTextStyleVO.COLOR_TITLE), contentList2));
+
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("澶囨敞", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO("濡傛湁鐤戦棶璇疯仈绯讳汉宸ュ鏈�", ClientTextStyleVO.COLOR_CONTENT)));
+
+
MsgMoneyDetail detail = new MsgMoneyDetail();
- detail.setBalance(balance);
- detail.setBeiZhu(beiZhu);
detail.setCreateTime(new Date());
detail.setMoney(money);
- detail.setMsgType(MsgTypeMoneyTypeEnum.fanliWeiQuan);
+ detail.setMsgType(typeEnum);
detail.setOrderId(orderId);
+ detail.setOrderType(source);
detail.setRead(false);
detail.setUser(new UserInfo(uid));
-
+ detail.setExtraInfo(new Gson().toJson(listMsg));
return detail;
}
@@ -176,38 +371,120 @@
* @param beiZhu
* @return
*/
- public static MsgMoneyDetail createInviteMsg(BigDecimal money, BigDecimal balance, int orderCount, int goodsCount,
- Long uid, String beiZhu) {
+ public static MsgMoneyDetail createTeamReceivedMsg(Long uid, BigDecimal money, BigDecimal balance, Date receivedDate,
+ String teamName) {
if (money == null || balance == null || uid == null)
return null;
+ List<CommonMsgItemVO> listMsg = new ArrayList<>();
+ List<ClientTextStyleVO> contentList = new ArrayList<>();
+ contentList.add(new ClientTextStyleVO(TimeUtil.getYearOnlyYYYY(receivedDate)+ "骞�", ClientTextStyleVO.COLOR_CONTENT));
+ contentList.add(new ClientTextStyleVO(TimeUtil.getMonthOnlyMM(receivedDate), ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
+ contentList.add(new ClientTextStyleVO("鏈�", ClientTextStyleVO.COLOR_CONTENT));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("缁撶畻鏈堝害", ClientTextStyleVO.COLOR_TITLE), contentList));
+
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鍒拌处绫荤洰", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO(teamName, ClientTextStyleVO.COLOR_CONTENT)));
+
+ List<ClientTextStyleVO> contentList2 = new ArrayList<>();
+ contentList2.add(new ClientTextStyleVO("楼" + money.setScale(2, BigDecimal.ROUND_DOWN), ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
+ contentList2.add(new ClientTextStyleVO("锛堣处鎴蜂綑棰澛� "+ balance.setScale(2, BigDecimal.ROUND_DOWN)+"锛�", ClientTextStyleVO.COLOR_CONTENT));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鍒拌处閲戦", ClientTextStyleVO.COLOR_TITLE), contentList2));
+ listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("澶囨敞", ClientTextStyleVO.COLOR_TITLE),
+ new ClientTextStyleVO("濡傛湁鐤戦棶璇疯仈绯讳汉宸ュ鏈�", ClientTextStyleVO.COLOR_CONTENT)));
+
MsgMoneyDetail detail = new MsgMoneyDetail();
detail.setBalance(balance);
- detail.setBeiZhu(beiZhu);
detail.setCreateTime(new Date());
- detail.setGoodsCount(goodsCount);
detail.setMoney(money);
detail.setMsgType(MsgTypeMoneyTypeEnum.invite);
- detail.setOrderCount(orderCount);
detail.setRead(false);
detail.setUser(new UserInfo(uid));
-
+ detail.setExtraInfo(new Gson().toJson(listMsg));
return detail;
}
+
+ private static String filterName(String oldname) {
+ String name = "";
+ if (StringUtil.isNullOrEmpty(oldname))
+ return name;
+
+ if (oldname.length() > 2)
+ for (int i = 0; i < oldname.length(); i++) {
+ if (i == 0)
+ name += oldname.charAt(i);
+ else
+ name += "*";
+ }
+ else
+ name = oldname.charAt(0) + "*";
+
+ return name;
+ }
+
+ public static String filterAccount(String alipayAccount) {
+ String account = "";
+ if (StringUtil.isNullOrEmpty(alipayAccount))
+ return account;
+
+ if (alipayAccount.indexOf("@") > -1) {// 閭
+ int index = alipayAccount.indexOf("@");
+
+ for (int i = 0; i < alipayAccount.length(); i++) {
+ if (i < 3 || i >= index)
+ account += alipayAccount.charAt(i);
+ else
+ account += "*";
+ }
+ } else if (StringUtil.isMobile(alipayAccount)) {// 鐢佃瘽
+ account = alipayAccount.substring(0, 7) + "****";
+ } else {// 鍏朵粬
+ if (alipayAccount.length() >= 6) {
+ for (int i = 0; i < alipayAccount.length(); i++) {
+ if (i < alipayAccount.length() - 4)
+ account += alipayAccount.charAt(i);
+ else
+ account += "*";
+ }
+ } else {
+ for (int i = 0; i < alipayAccount.length(); i++) {
+ if (i < alipayAccount.length() - 1)
+ account += alipayAccount.charAt(i);
+ else
+ account += "*";
+ }
+ }
+ }
+ return account;
+ }
+
+
/**
- * 閭�璇疯禋缁存潈
- *
+ * 绾㈠寘鐩稿叧淇℃伅
* @param uid
- * @param orderId
- * @param money
- * @param balance
+ * @param type
+ * @param content
* @param beiZhu
* @return
*/
- public static MsgMoneyDetail createInviteWeiQuanMsg(Long uid, String orderId, BigDecimal money, BigDecimal balance,
+ public static MsgMoneyDetail createRedPackMsg(Long uid, MsgTypeMoneyTypeEnum type, String content, String beiZhu) {
+ if (uid == null || type == null || StringUtil.isNullOrEmpty(content))
+ return null;
+ MsgMoneyDetail detail = new MsgMoneyDetail();
+ detail.setUser(new UserInfo(uid));
+ detail.setRead(false);
+ detail.setContent(content);
+ detail.setMsgType(type);
+ detail.setBeiZhu(beiZhu);
+ detail.setCreateTime(new Date());
+ return detail;
+ }
+
+
+ public static MsgMoneyDetail createSystemEqualizeMsg(Long uid, String reason, BigDecimal money, BigDecimal balance,
String beiZhu) {
- if (money == null || orderId == null || money == null || uid == null)
+ if (money == null || money == null || uid == null)
return null;
MsgMoneyDetail detail = new MsgMoneyDetail();
@@ -215,86 +492,12 @@
detail.setBeiZhu(beiZhu);
detail.setCreateTime(new Date());
detail.setMoney(money);
- detail.setMsgType(MsgTypeMoneyTypeEnum.inviteWeiQuan);
- detail.setOrderId(orderId);
- detail.setRead(false);
- detail.setUser(new UserInfo(uid));
-
- return detail;
- }
-
- /**
- * 鍒嗕韩璧氬埌璐�
- *
- * @param money
- * @param balance
- * @param orderCount
- * @param goodsCount
- * @param uid
- * @param beiZhu
- * @return
- */
- public static MsgMoneyDetail createShareMsg(BigDecimal money, BigDecimal balance, int orderCount, int goodsCount,
- Long uid, String beiZhu) {
- if (money == null || balance == null || uid == null)
- return null;
-
- MsgMoneyDetail detail = new MsgMoneyDetail();
- detail.setBalance(balance);
- detail.setBeiZhu(beiZhu);
- detail.setCreateTime(new Date());
- detail.setGoodsCount(goodsCount);
- detail.setMoney(money);
- detail.setMsgType(MsgTypeMoneyTypeEnum.share);
- detail.setOrderCount(orderCount);
- detail.setRead(false);
- detail.setUser(new UserInfo(uid));
-
- return detail;
- }
-
- /**
- * 鍒嗕韩璧氱淮鏉�
- *
- * @param uid
- * @param orderId
- * @param money
- * @param balance
- * @param beiZhu
- * @return
- */
- public static MsgMoneyDetail createShareWeiQuanMsg(Long uid, String orderId, BigDecimal money, BigDecimal balance,
- String beiZhu) {
- if (money == null || orderId == null || money == null || uid == null)
- return null;
- MsgMoneyDetail detail = new MsgMoneyDetail();
- detail.setBalance(balance);
- detail.setBeiZhu(beiZhu);
- detail.setCreateTime(new Date());
- detail.setMoney(money);
- detail.setMsgType(MsgTypeMoneyTypeEnum.shareWeiQuan);
- detail.setOrderId(orderId);
+ detail.setMsgType(MsgTypeMoneyTypeEnum.systemEqualize);
+ detail.setOrderId(reason);
detail.setRead(false);
detail.setUser(new UserInfo(uid));
return detail;
}
-
- public static MsgMoneyDetail createOrderRewardMsg(Long uid, String orderId, BigDecimal money, BigDecimal balance,
- String beiZhu) {
- if (money == null || orderId == null || money == null || uid == null)
- return null;
-
- MsgMoneyDetail detail = new MsgMoneyDetail();
- detail.setBalance(balance);
- detail.setBeiZhu(beiZhu);
- detail.setCreateTime(new Date());
- detail.setMoney(money);
- detail.setMsgType(MsgTypeMoneyTypeEnum.orderReward);
- detail.setOrderId(orderId);
- detail.setRead(false);
- detail.setUser(new UserInfo(uid));
- return detail;
- }
}
--
Gitblit v1.8.0