From 469bba3a544b3beef0c170f6fce5804c9e8a9676 Mon Sep 17 00:00:00 2001 From: yujian <yujian@163.com> Date: 星期五, 10 四月 2020 17:02:51 +0800 Subject: [PATCH] 消息 --- fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgMoneyDetailFactory.java | 393 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 294 insertions(+), 99 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 2356266..ae8536a 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,114 +1,81 @@ package com.yeshi.fanli.util.factory.msg; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Calendar; 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.msg.MsgOrderDetail.MsgTypeOrderTypeEnum; import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory; import com.yeshi.fanli.entity.bus.user.Extract; import com.yeshi.fanli.entity.bus.user.ExtractWeiXinRecord; import com.yeshi.fanli.entity.bus.user.UserInfo; +import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.MoneyBigDecimalUtil; +import com.yeshi.fanli.util.TimeUtil; +import com.yeshi.fanli.util.account.UserUtil; +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) { 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), 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("濡傛湁鐤戦棶璇疯仈绯讳汉宸ュ鏈�", 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("浜哄伐瀹℃牳涓�"); - 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 createExtractAutoMsg(ExtractWeiXinRecord extractRecord, String stateDesc, String desc, - String beiZhu) { - if (extractRecord == null) - return null; - MsgMoneyDetail detail = new MsgMoneyDetail(); - detail.setUser(new UserInfo(extractRecord.getUid())); - detail.setRead(false); - detail.setMoney(extractRecord.getMoney()); - detail.setMsgType(MsgTypeMoneyTypeEnum.extractAutoWX); - detail.setExtract(new Extract(extractRecord.getId())); detail.setStateDesc(stateDesc); - detail.setDesc(desc); - detail.setBeiZhu(beiZhu); - detail.setCreateTime(new Date()); + detail.setExtraInfo(new Gson().toJson(listMsg)); 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; - } /** * 璐﹀彿楠岃瘉娑堟伅 @@ -119,21 +86,96 @@ * @return */ public static MsgMoneyDetail createAlipayAccountValidMsg(AlipayAccountValidNormalHistory valid, Long uid, - String appName, BigDecimal money, String beiZhu) { + String appName, BigDecimal money, int 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 + "", ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT))); + listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("鎻愮幇璐﹀彿", ClientTextStyleVO.COLOR_TITLE), + new ClientTextStyleVO(String.format("鎻愮幇璐﹀彿鏀跺埌涓�绗旓紝鏉ヨ嚜%s鐨勮浆璐︼紝鍗崇粦瀹氭垚鍔�", appName), ClientTextStyleVO.COLOR_CONTENT))); + 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鏀粯瀹濋獙璇乗"鐨�%s鍏冭浆璐︺��", appName, appName, - 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 = "淇敼"; + } + 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("璇蜂粩缁嗘牳瀵瑰~鍐欒处鍙锋槸鍚︽湁璇垨璺濅笂涓�娆′慨鏀规椂闀挎槸鍚﹁秴杩�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; + } + + /** * 杩斿埄鍒拌处 @@ -146,23 +188,61 @@ * @param beiZhu * @return */ - public static MsgMoneyDetail createFailiMsg(BigDecimal money, BigDecimal balance, String orderId, int orderType, - int goodsCount, Long uid, String beiZhu) { + public static MsgMoneyDetail createOrderReceivedMsg(BigDecimal money, BigDecimal balance, String orderId, int source, + int goodsCount, Long uid, int type, Date downTime, boolean useCoupon) { if (money == null || balance == null || orderId == null || uid == null) return null; + String fanliName = ""; + MsgTypeMoneyTypeEnum typeEnum = null; + String sourceName = Constant.getSourceName(source); + if (Constant.TYPE_REBATE == type) { + fanliName = "鑷喘杩斿埄"; + sourceName += "-杩斿埄璁㈠崟"; + typeEnum = MsgTypeMoneyTypeEnum.fanli; + } else if (Constant.TYPE_SHAER == type) { + fanliName = "鍒嗕韩濂栭噾锛�"; + sourceName += "-鍒嗕韩璁㈠崟"; + typeEnum = MsgTypeMoneyTypeEnum.share; + } + + 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), true)); + + List<ClientTextStyleVO> contentList = new ArrayList<>(); + contentList.add(new ClientTextStyleVO("涓嬪崟鏃堕棿锛�" + TimeUtil.formatDate(downTime), ClientTextStyleVO.COLOR_CONTENT)); + 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, ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT)); + contentList2.add(new ClientTextStyleVO("锛堣处鎴蜂綑棰澛ワ級"+ balance, 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.setMsgType(typeEnum); detail.setOrderId(orderId); - detail.setOrderType(orderType); + detail.setOrderType(source); detail.setRead(false); detail.setUser(new UserInfo(uid)); - + detail.setExtraInfo(new Gson().toJson(listMsg)); return detail; } @@ -176,22 +256,63 @@ * @param beiZhu * @return */ - public static MsgMoneyDetail createFailiWeiQuanMsg(Long uid, String orderId, int orderType, 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), true)); + + List<ClientTextStyleVO> contentList = new ArrayList<>(); + contentList.add(new ClientTextStyleVO("涓嬪崟鏃堕棿锛�" + TimeUtil.formatDate(downTime), ClientTextStyleVO.COLOR_CONTENT)); + 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) + "锛堝師鍒拌处閲戦锛�", ClientTextStyleVO.COLOR_CONTENT))); + + List<ClientTextStyleVO> contentList2 = new ArrayList<>(); + contentList2.add(new ClientTextStyleVO("楼" + money.setScale(2), 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(orderType); + detail.setOrderType(source); detail.setRead(false); detail.setUser(new UserInfo(uid)); - + detail.setExtraInfo(new Gson().toJson(listMsg)); return detail; } @@ -206,23 +327,35 @@ * @param beiZhu * @return */ - public static MsgMoneyDetail createInviteMsg(BigDecimal money, BigDecimal balance, int orderType, int orderCount, - int goodsCount, Long uid, String beiZhu) { + public static MsgMoneyDetail createTeamReceivedMsg(Long uid, BigDecimal money, BigDecimal balance, Date receivedDate) { 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("鍥㈤槦鏀剁泭", ClientTextStyleVO.COLOR_CONTENT), true)); + + List<ClientTextStyleVO> contentList2 = new ArrayList<>(); + contentList2.add(new ClientTextStyleVO("楼" + money.setScale(2), ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT)); + contentList2.add(new ClientTextStyleVO("锛堣处鎴蜂綑棰澛� "+ balance.setScale(2)+"锛�", 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.setOrderType(orderType); - + detail.setExtraInfo(new Gson().toJson(listMsg)); return detail; } @@ -455,5 +588,67 @@ detail.setCreateTime(new Date()); 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 < 3 || i >= alipayAccount.length() - 2) + account += alipayAccount.charAt(i); + else + account += "*"; + } + } else { + for (int i = 0; i < alipayAccount.length(); i++) { + if (i < 1 || i >= alipayAccount.length() - 1) + account += alipayAccount.charAt(i); + else + account += "*"; + } + } + } + return account; + } + + + + + + } -- Gitblit v1.8.0