admin
2019-01-19 23f7b250c00597ad89282075460a4c27dffe1ada
Merge branch 'dev-msg'
39个文件已修改
55个文件已添加
6603 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/UserAccountController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java 351 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/goods/RecommendUserGoodsMapMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/goods/RecommendUserGoodsMapper.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/MsgAccountDetailMapper.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/MsgInviteDetailMapper.java 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/MsgMoneyDetailMapper.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/MsgOrderDetailMapper.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/SystemZnxMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/UserMsgUnReadNumMapper.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/UserSystemMsgMapper.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgAccountDetail.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgInviteDetail.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgMoneyDetail.java 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOrderDetail.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/UserMsgUnReadNum.java 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/UserSystemMsg.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/AlipayAccountValidNormalHistory.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/Extract.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/ThreeSale.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/goods/RecommendUserGoods.java 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/goods/RecommendUserGoodsMap.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/order/HongBaoOrder.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/system/SystemZnx.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/goods/RecommendUserGoodsException.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/msg/MsgAccountDetailException.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/msg/MsgInviteDetailException.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/msg/MsgMoneyDetailException.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/msg/MsgOrderDetailException.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/exception/msg/UserSystemMsgException.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/UpdateThreeSaleJob.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/goods/RecommendUserGoodsMapMapper.xml 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/goods/RecommendUserGoodsMapper.xml 99 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgAccountDetailMapper.xml 117 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgInviteDetailMapper.xml 146 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgMoneyDetailMapper.xml 156 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgOrderDetailMapper.xml 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/msg/SystemZnxMapper.xml 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/msg/UserMsgUnReadNumMapper.xml 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/msg/UserSystemMsgMapper.xml 149 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/RecommendUserGoodsServiceImpl.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoServiceImpl.java 125 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java 277 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/ThreeSaleSerivceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgAccountDetailServiceImpl.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgInviteDetailServiceImpl.java 72 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgMoneyDetailServiceImpl.java 101 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOrderDetailServiceImpl.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserAccountMsgNotificationServiceImpl.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserInviteMsgNotificationServiceImpl.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserMoneyMsgNotificationServiceImpl.java 134 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserMsgReadStateServiceImpl.java 186 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOrderMsgNotificationServiceImpl.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserSystemMsgServiceImpl.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java 393 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/PidOrderServiceImpl.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoWeiQuanDrawBackServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoWeiQuanOrderServiceImpl.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/ExtractServiceImpl.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserNotificationServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/goods/RecommendUserGoodsService.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/hongbao/HongBaoService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgAccountDetailService.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgInviteDetailService.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgMoneyDetailService.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgOrderDetailService.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserAccountMsgNotificationService.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserInviteMsgNotificationService.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserMoneyMsgNotificationService.java 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserMsgReadStateService.java 102 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserOrderMsgNotificationService.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserSystemMsgService.java 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/OrderProcessService.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserNotificationService.java 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/TaoBaoHttpUtil.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/account/UserUtil.java 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgAccountDetailFactory.java 111 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgInviteDetailFactory.java 83 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgMoneyDetailFactory.java 277 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgOrderDetailFactory.java 100 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java 384 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/msg/MsgTypeAccountTypeEnumHandler.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/msg/MsgTypeInviteTypeEnumHandler.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/msg/MsgTypeMoneyTypeEnumHandler.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/msg/MsgTypeOrderTypeEnumHandler.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/msg/UserSystemMsgTypeEnumHandler.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/msg/ClientTextStyleVO.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/msg/UserHomeMsgVO.java 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/vo/msg/UserSystemMsgVO.java 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/test/java/org/fanli/TBImgTest.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/test/java/org/fanli/TaoKeTest.java 45 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/UserAccountController.java
@@ -30,7 +30,6 @@
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.InviteGetMoneyService;
import com.yeshi.fanli.service.inter.config.SystemService;
import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java
@@ -4,29 +4,88 @@
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.BigDecimalUtil;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.taobao.TbImgUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonPrimitive;
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
import com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum;
import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.goods.RecommendUserGoods;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.exception.msg.UserSystemMsgException;
import com.yeshi.fanli.service.inter.goods.RecommendUserGoodsService;
import com.yeshi.fanli.service.inter.msg.MsgAccountDetailService;
import com.yeshi.fanli.service.inter.msg.MsgInviteDetailService;
import com.yeshi.fanli.service.inter.msg.MsgMoneyDetailService;
import com.yeshi.fanli.service.inter.msg.MsgOrderDetailService;
import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
import com.yeshi.fanli.service.inter.msg.UserSystemMsgService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.factory.msg.UserMsgVOFactory;
import com.yeshi.fanli.vo.msg.UserHomeMsgVO;
import com.yeshi.fanli.vo.msg.UserMsgVO;
import com.yeshi.fanli.vo.msg.UserSystemMsgVO;
import net.sf.json.JSONObject;
@Controller
@RequestMapping("api/v1/user/msg")
public class UserMsgController {
    @Resource
    private MsgOrderDetailService msgOrderDetailService;
    @Resource
    private MsgMoneyDetailService msgMoneyDetailService;
    @Resource
    private MsgInviteDetailService msgInviteDetailService;
    @Resource
    private MsgAccountDetailService msgAccountDetailService;
    @Resource
    private UserMsgReadStateService userMsgReadStateService;
    @Resource
    private RecommendUserGoodsService recommendUserGoodsService;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private UserSystemMsgService userSystemMsgService;
    // 消息的类型
    final static String MSG_TYPE_ORDER = "order";
    final static String MSG_TYPE_MONEY = "money";
    final static String MSG_TYPE_ACCOUNT = "account";
    final static String MSG_TYPE_INVITE = "invite";
    /**
     * 获取订单消息列表
     * 
@@ -35,65 +94,275 @@
     * @param page
     * @param out
     */
    @RequestMapping(value = "getOrderMsgList", method = RequestMethod.POST)
    public void getOrderMsgList(AcceptData acceptData, Long uid, int page, PrintWriter out) {
    @RequestMapping(value = "getMsgList", method = RequestMethod.POST)
    public void getOrderMsgList(AcceptData acceptData, Long uid, int page, String type, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        if (StringUtil.isNullOrEmpty(type)) {
            out.print(JsonUtil.loadFalseResult(2, "请上传type"));
            return;
        }
        List<UserMsgVO> list = new ArrayList<>();
        long count = 0;
        List<CommonMsgItemVO> items = new ArrayList<>();
        switch (type) {
        case MSG_TYPE_ORDER:
            userMsgReadStateService.readOrderMsg(uid);
            List<MsgOrderDetail> detailList = msgOrderDetailService.listMsgOrderDetail(uid, page);
            count = msgOrderDetailService.countMsgOrderDetail(uid);
            if (detailList != null)
                for (MsgOrderDetail detail : detailList)
                    list.add(UserMsgVOFactory.create(detail));
            break;
        case MSG_TYPE_MONEY:
            userMsgReadStateService.readMoneyMsg(uid);
            List<MsgMoneyDetail> detailList1 = msgMoneyDetailService.listMsgMoneyDetail(uid, page);
            count = msgMoneyDetailService.countMsgMoneyDetail(uid);
            if (detailList1 != null)
                for (MsgMoneyDetail detail : detailList1)
                    list.add(UserMsgVOFactory.create(detail));
            break;
        case MSG_TYPE_ACCOUNT:
            userMsgReadStateService.readAccountMsg(uid);
            List<MsgAccountDetail> detailList2 = msgAccountDetailService.listMsgAccountDetail(uid, page);
            count = msgAccountDetailService.countMsgAccountDetail(uid);
            if (detailList2 != null)
                for (MsgAccountDetail detail : detailList2)
                    list.add(UserMsgVOFactory.create(detail));
            break;
        case MSG_TYPE_INVITE:
            userMsgReadStateService.readInviteMsg(uid);
            List<MsgInviteDetail> detailList3 = msgInviteDetailService.listMsgInviteDetail(uid, page);
            count = msgInviteDetailService.countMsgInviteDetail(uid);
            if (detailList3 != null)
                for (MsgInviteDetail detail : detailList3)
                    list.add(UserMsgVOFactory.create(detail));
            break;
        }
        List<ClientTextStyleVO> contentList = new ArrayList<>();
        contentList.add(new ClientTextStyleVO("206089388856584237", "#000000"));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单号", "#888888"), contentList));
        contentList.clear();
        contentList.add(new ClientTextStyleVO("共", "#000000"));
        contentList.add(new ClientTextStyleVO("1", "#E5005C"));
        contentList.add(new ClientTextStyleVO("件商品", "#000000"));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("商品数量", "#888888"), contentList));
        contentList.clear();
        contentList.add(new ClientTextStyleVO("邀请订单", "#000000"));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单类型", "#888888"), contentList));
        contentList.clear();
        contentList.add(new ClientTextStyleVO("已付款", "#E5005C"));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单状态", "#888888"), contentList));
        contentList.clear();
        contentList.add(new ClientTextStyleVO("¥58", "#E5005C"));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("付款金额", "#888888"), contentList));
        contentList.clear();
        contentList.add(new ClientTextStyleVO("¥0.36", "#E5005C"));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请奖金", "#888888"), contentList));
        contentList.clear();
        contentList.add(new ClientTextStyleVO("无", "#000000"));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", "#888888"), contentList));
        list.add(new UserMsgVO("http://ec-1255749512.file.myqcloud.com/resource/portrait.png", "订单消息", new Date(),
                items));
        GsonBuilder builder = new GsonBuilder();
        builder.registerTypeAdapter(BigDecimal.class, new JsonSerializer<Date>() {
        builder = getTimeDescJsonBuilder(builder);
        JSONObject root = new JSONObject();
        root.put("data", builder.create().toJson(list));
        root.put("count", count);
        out.print(JsonUtil.loadTrueResult(root));
    }
    /**
     * 获取消息未读数
     *
     * @param acceptData
     * @param uid
     * @param out
     */
    @RequestMapping(value = "getUnReadMsgCount", method = RequestMethod.POST)
    public void getUnReadMsgCount(AcceptData acceptData, Long uid, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
        JSONObject data = JSONObject.fromObject(JsonUtil.getApiCommonGson().toJson(num));
        data.put("totalCount", num.getTypeAccount() + num.getTypeInvite() + num.getTypeMoney() + num.getTypeOrder()
                + num.getTypeScore() + num.getTypeSystem());
        out.print(JsonUtil.loadTrueResult(data));
    }
    private String getTimeDesc(Date nowDate, Date targetDate) {
        Calendar now = Calendar.getInstance();
        now.setTime(nowDate);
        if (TimeUtil.getGernalTime(targetDate.getTime(), "yyyy-MM-dd")
                .equalsIgnoreCase(TimeUtil.getGernalTime(now.getTimeInMillis(), "yyyy-MM-dd"))) {
            return "今天 " + TimeUtil.getGernalTime(targetDate.getTime(), "HH:mm");
        } else if (TimeUtil.getGernalTime(targetDate.getTime(), "yyyy-MM-dd")
                .equalsIgnoreCase(TimeUtil.getGernalTime(now.getTimeInMillis() - 1000 * 60 * 60 * 24L, "yyyy-MM-dd"))) {
            return "昨天 " + TimeUtil.getGernalTime(targetDate.getTime(), "HH:mm");
        } else {
            return TimeUtil.getGernalTime(targetDate.getTime(), "yyyy.MM.dd HH:mm");
        }
    }
    private GsonBuilder getTimeDescJsonBuilder(GsonBuilder builder) {
        builder = builder.registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
            @Override
            public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) {
                if (value == null) {
                    return new JsonPrimitive("");
                } else {
                    return new JsonPrimitive("今天 10:25");
                    Calendar now = Calendar.getInstance();
                    return new JsonPrimitive(getTimeDesc(new Date(now.getTimeInMillis()), value));
                }
            }
        }).registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
            @Override
            public JsonElement serialize(BigDecimal value, Type theType, JsonSerializationContext context) {
                if (value == null) {
                    return new JsonPrimitive("0");
                } else {
                    return new JsonPrimitive(BigDecimalUtil.getWithNoZera(value).toString());
                }
            }
        });
        return builder;
    }
    /**
     * 获取首页消息
     *
     * @param acceptData
     * @param uid
     * @param page
     * @param out
     */
    @RequestMapping(value = "getHomeMsgList", method = RequestMethod.POST)
    public void getHomeMsgList(AcceptData acceptData, Long uid, int page, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        List<UserHomeMsgVO> volist = new ArrayList<>();
        List<RecommendUserGoods> list = recommendUserGoodsService.listRecommend(uid, page, Constant.PAGE_SIZE);
        long count = recommendUserGoodsService.countRecommend(uid) + 1;// 计算欢迎语的数量
        Date now = new Date();
        for (RecommendUserGoods goods : list) {
            UserHomeMsgVO vo = new UserHomeMsgVO();
            vo.setContent(goods.getRecommendDesc());
            vo.setCreateTime(getTimeDesc(now, goods.getCreateTime()));
            if (goods.getGoodsList().size() == 1)
                vo.setType(UserHomeMsgVO.TYPE_GOODS_1);
            else if (goods.getGoodsList().size() == 2)
                vo.setType(UserHomeMsgVO.TYPE_GOODS_2);
            else if (goods.getGoodsList().size() == 3)
                vo.setType(UserHomeMsgVO.TYPE_GOODS_3);
            List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
            for (CommonGoods cg : goods.getGoodsList()) {
                if (goods.getGoodsList().size() == 1)
                    cg.setPicture(TbImgUtil.getTBSizeImg(cg.getPicture(), 400));
                else if (goods.getGoodsList().size() == 2)
                    cg.setPicture(TbImgUtil.getTBSizeImg(cg.getPicture(), 320));
                else if (goods.getGoodsList().size() == 3)
                    cg.setPicture(TbImgUtil.getTBSizeImg(cg.getPicture(), 220));
                TaoBaoGoodsBrief tbGoods = new TaoBaoGoodsBrief();
                if (cg.getCouponAmount() == null)
                    tbGoods.setCouponAmount(new BigDecimal(0));
                else
                    tbGoods.setCouponAmount(cg.getCouponAmount());
                tbGoods.setAuctionId(cg.getGoodsId());
                tbGoods.setPictUrl(cg.getPicture());
                goodsList.add(tbGoods);
            }
            vo.setGoodsList(goodsList);
            vo.setTitle("猜你喜欢");
            vo.setIcon("http://img.flqapp.com/resource/msg/icon_msg_guess_like.png");
            volist.add(vo);
        }
        if (volist.size() > 0 && volist.size() < Constant.PAGE_SIZE) {
            // 添加欢迎语
            UserHomeMsgVO vo = new UserHomeMsgVO();
            vo.setContent("恭喜你,成为返利券的用户\n独家优惠券帮你省钱;\n参与奖金活动帮你赚钱;\n让返利券成为你的省钱助手吧!");
            vo.setTitle("新人欢迎");
            vo.setCreateTime(getTimeDesc(now, new Date(userInfoService.getUserById(uid).getCreatetime())));
            vo.setType(UserHomeMsgVO.TYPE_WELCOME);
            volist.add(vo);
        }
        JSONObject root = new JSONObject();
        root.put("data", builder.create().toJson(list));
        root.put("count", 1);
        root.put("msgList", new Gson().toJson(volist));
        if (page == 1) {
            UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
            UserSystemMsg usm = userSystemMsgService.getLatestUserSystemMsg(uid);
            if (usm != null)
                root.put("systemMsg",
                        new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(), usm.getTitle(),
                                usm.getContent(),
                                usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "",
                                Constant.systemCommonConfig.getDefaultPortrait(), getTimeDesc(now, usm.getCreateTime()),
                                num.getTypeSystem()));
        }
        root.put("count", count);
        out.print(JsonUtil.loadTrueResult(root));
    }
    /**
     * 获取系统消息列表
     *
     * @param acceptData
     * @param uid
     * @param page
     * @param out
     */
    @RequestMapping(value = "getSystemMsgList", method = RequestMethod.POST)
    public void getSystemMsgList(AcceptData acceptData, Long uid, int page, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        List<UserSystemMsgVO> voList = new ArrayList<>();
        List<UserSystemMsg> list = userSystemMsgService.listUserSystemMsg(uid, page, Constant.PAGE_SIZE);
        if (list != null)
            for (UserSystemMsg usm : list) {
                voList.add(new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(), usm.getTitle(),
                        usm.getContent(),
                        usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "", null,
                        usm.getCreateTime().getTime() + "", 0));
            }
        long count = userSystemMsgService.countUserSystemMsg(uid);
        userMsgReadStateService.readUserSystemMsg(uid);
        JSONObject root = new JSONObject();
        root.put("data", voList);
        root.put("count", count);
        out.print(JsonUtil.loadTrueResult(root));
    }
    /**
     * 设置问题已经解决
     *
     * @param acceptData
     * @param uid
     * @param id
     * @param out
     */
    @RequestMapping(value = "setSystemMsgSolved", method = RequestMethod.POST)
    public void setSystemMsgSolved(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        if (id == null) {
            out.print(JsonUtil.loadFalseResult(2, "消息ID为空"));
            return;
        }
        try {
            userSystemMsgService.setSystemMsgSolved(uid, id);
            out.print(JsonUtil.loadTrueResult(""));
        } catch (UserSystemMsgException e) {
            out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
        }
    }
    @RequestMapping(value = "setAllMsgRead", method = RequestMethod.POST)
    public void setAllMsgRead(AcceptData acceptData, Long uid, PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
        }
        userMsgReadStateService.setAllMsgRead(uid);
        out.print(JsonUtil.loadTrueResult(""));
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/goods/RecommendUserGoodsMapMapper.java
New file
@@ -0,0 +1,9 @@
package com.yeshi.fanli.dao.mybatis.goods;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.goods.RecommendUserGoodsMap;
public interface RecommendUserGoodsMapMapper extends BaseMapper<RecommendUserGoodsMap>{
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/goods/RecommendUserGoodsMapper.java
New file
@@ -0,0 +1,30 @@
package com.yeshi.fanli.dao.mybatis.goods;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.goods.RecommendUserGoods;
public interface RecommendUserGoodsMapper extends BaseMapper<RecommendUserGoods> {
    /**
     * 获取用户的推荐列表
     *
     * @param uid
     * @param start
     * @param size
     * @return
     */
    List<RecommendUserGoods> listRecommendGoods(@Param("uid") Long uid, @Param("start") long start,
            @Param("count") int count);
    /**
     * 用户推荐的数量
     *
     * @param uid
     * @return
     */
    Long countRecommendGoods(@Param("uid") Long uid);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/MsgAccountDetailMapper.java
New file
@@ -0,0 +1,37 @@
package com.yeshi.fanli.dao.mybatis.msg;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
public interface MsgAccountDetailMapper extends BaseMapper<MsgAccountDetail> {
    /**
     * 根据用户查询消息,根据更新时间倒叙
     *
     * @param uid
     * @param start
     * @param count
     * @return
     */
    List<MsgAccountDetail> listByUid(@Param("uid") Long uid, @Param("start") long start, @Param("count") int count);
    /**
     * 根据用户查询数量
     *
     * @param uid
     * @return
     */
    Long countByUid(@Param("uid") Long uid);
    /**
     * 设置消息已读时
     *
     * @param uid
     */
    void setMsgReadByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/MsgInviteDetailMapper.java
New file
@@ -0,0 +1,45 @@
package com.yeshi.fanli.dao.mybatis.msg;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
public interface MsgInviteDetailMapper extends BaseMapper<MsgInviteDetail> {
    /**
     * 根据邀请ID获取数据
     *
     * @param threeSaleId
     * @return
     */
    MsgInviteDetail selectByThreeSaleId(Long threeSaleId);
    /**
     * 根据用户查询消息,根据更新时间倒叙
     *
     * @param uid
     * @param start
     * @param count
     * @return
     */
    List<MsgInviteDetail> listByUid(@Param("uid") Long uid, @Param("start") long start, @Param("count") int count);
    /**
     * 根据用户查询数量
     *
     * @param uid
     * @return
     */
    Long countByUid(@Param("uid") Long uid);
    /**
     * 设置消息已读时
     *
     * @param uid
     */
    void setMsgReadByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/MsgMoneyDetailMapper.java
New file
@@ -0,0 +1,26 @@
package com.yeshi.fanli.dao.mybatis.msg;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
public interface MsgMoneyDetailMapper extends BaseMapper<MsgMoneyDetail> {
    MsgMoneyDetail selectBySourceIdAndMsgType(@Param("sourceId") Long sourceId,
            @Param("type") MsgTypeMoneyTypeEnum type);
    List<MsgMoneyDetail> listByUid(@Param("uid") Long uid, @Param("start") long start, @Param("count") int count);
    Long countByUid(@Param("uid") Long uid);
    /**
     * 设置消息已读时
     *
     * @param uid
     */
    void setMsgReadByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/MsgOrderDetailMapper.java
New file
@@ -0,0 +1,27 @@
package com.yeshi.fanli.dao.mybatis.msg;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
public interface MsgOrderDetailMapper extends BaseMapper<MsgOrderDetail> {
    MsgOrderDetail selectByUidAndOrderId(@Param("uid") Long uid, @Param("orderId") String orderId);
    List<MsgOrderDetail> listByUid(@Param("uid") Long uid, @Param("start") long start, @Param("count") int count);
    List<MsgOrderDetail> listByOrderId(@Param("orderId") String orderId);
    Long countByUid(@Param("uid") Long uid);
    /**
     * 设置消息已读时
     *
     * @param uid
     */
    void setMsgReadByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/SystemZnxMapper.java
New file
@@ -0,0 +1,8 @@
package com.yeshi.fanli.dao.mybatis.msg;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.system.SystemZnx;
public interface SystemZnxMapper extends BaseMapper<SystemZnx>{
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/UserMsgUnReadNumMapper.java
New file
@@ -0,0 +1,10 @@
package com.yeshi.fanli.dao.mybatis.msg;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum;
public interface UserMsgUnReadNumMapper extends BaseMapper<UserMsgUnReadNum> {
    UserMsgUnReadNum selectByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/UserSystemMsgMapper.java
New file
@@ -0,0 +1,52 @@
package com.yeshi.fanli.dao.mybatis.msg;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
public interface UserSystemMsgMapper extends BaseMapper<UserSystemMsg> {
    /**
     * 用户系统消息列表
     *
     * @param uid
     * @param start
     * @param count
     * @return
     */
    List<UserSystemMsg> listByUid(@Param("uid") Long uid, @Param("start") long start, @Param("count") int count);
    /**
     * 用户系统消息数量
     *
     * @param uid
     * @return
     */
    Long countByUid(@Param("uid") Long uid);
    /**
     * 根据系统站内信的ID获取消息
     *
     * @param id
     * @return
     */
    UserSystemMsg selectBySystemZNXId(@Param("id")Long id);
    /**
     * 获取最近一条消息
     *
     * @param uid
     * @return
     */
    UserSystemMsg selectLatestUserSystemMsg(@Param("uid")Long uid);
    /**
     * 设置消息已读时
     *
     * @param uid
     */
    void setMsgReadByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgAccountDetail.java
@@ -1,5 +1,10 @@
package com.yeshi.fanli.entity.bus.msg;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.entity.bus.user.UserInfo;
/**
@@ -8,12 +13,13 @@
 * @author Administrator
 *
 */
@Table("yeshi_ec_msg_account")
public class MsgAccountDetail {
    public enum MsgTypeAccountEnumType {
    public enum MsgTypeAccountTypeEnum {
        bingding("账号绑定"), cancelBinding("取消绑定"), bingdingChange("绑定更换"), update("账号修改"), level("账号等级"), connect("账号合并");
        private final String desc;
        private MsgTypeAccountEnumType(String desc) {
        private MsgTypeAccountTypeEnum(String desc) {
            this.desc = desc;
        }
@@ -22,11 +28,56 @@
        }
    }
    @Column(name = "ma_id")
    private Long id;
    @Column(name = "ma_uid")
    private UserInfo user;
    private MsgTypeAccountEnumType type;// 类型
    @Column(name = "ma_type")
    private MsgTypeAccountTypeEnum type;// 类型
    @Column(name = "ma_title")
    private String title;// 事项
    @Column(name = "ma_content")
    private String content;// 状态
    @Column(name = "ma_beizhu")
    private String beiZhu;// 备注
    @Column(name = "ma_read")
    private Boolean read;
    @Column(name = "ma_create_time")
    private Date createTime;
    @Column(name = "ma_update_time")
    private Date updateTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Boolean getRead() {
        return read;
    }
    public void setRead(Boolean read) {
        this.read = read;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public UserInfo getUser() {
        return user;
@@ -52,11 +103,11 @@
        this.content = content;
    }
    public MsgTypeAccountEnumType getType() {
    public MsgTypeAccountTypeEnum getType() {
        return type;
    }
    public void setType(MsgTypeAccountEnumType type) {
    public void setType(MsgTypeAccountTypeEnum type) {
        this.type = type;
    }
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgInviteDetail.java
@@ -2,6 +2,9 @@
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserInfo;
@@ -11,12 +14,13 @@
 * @author Administrator
 *
 */
@Table("yeshi_ec_msg_invite")
public class MsgInviteDetail {
    public enum MsgTypeInviteEnumType {
    public enum MsgTypeInviteTypeEnum {
        invite("邀请消息");
        private final String desc;
        private MsgTypeInviteEnumType(String desc) {
        private MsgTypeInviteTypeEnum(String desc) {
            this.desc = desc;
        }
@@ -25,14 +29,23 @@
        }
    }
    @Column(name="mi_id")
    private Long id;
    @Column(name="mi_uid")
    private UserInfo user;
    private MsgTypeInviteEnumType msgType;// 消息类型
    @Column(name="mi_type")
    private MsgTypeInviteTypeEnum msgType;// 消息类型
    @Column(name="mi_invite_id")
    private ThreeSale inviteUser;// 邀请信息
    @Column(name="mi_desc")
    private String desc;// 说明
    @Column(name="mi_beizhu")
    private String beiZhu;// 备注
    @Column(name="mi_read")
    private Boolean read;// 是否已读
    @Column(name="mi_create_time")
    private Date createTime;
    @Column(name="mi_update_time")
    private Date updateTime;
    public Long getId() {
@@ -51,11 +64,11 @@
        this.user = user;
    }
    public MsgTypeInviteEnumType getMsgType() {
    public MsgTypeInviteTypeEnum getMsgType() {
        return msgType;
    }
    public void setMsgType(MsgTypeInviteEnumType msgType) {
    public void setMsgType(MsgTypeInviteTypeEnum msgType) {
        this.msgType = msgType;
    }
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgMoneyDetail.java
@@ -3,6 +3,9 @@
import java.math.BigDecimal;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
import com.yeshi.fanli.entity.bus.user.Extract;
import com.yeshi.fanli.entity.bus.user.UserInfo;
@@ -13,12 +16,14 @@
 * @author Administrator
 *
 */
@Table("yeshi_ec_msg_money")
public class MsgMoneyDetail {
    public enum MsgTypeMoneyEnumType {
        share("分享奖金"), invite("邀请奖金"), fanli("返利到账"), extract("提现"), extractValid("提现账号验证");
    public enum MsgTypeMoneyTypeEnum {
        share("分享奖金"), invite("邀请奖金"), fanli("返利到账"), extract("提现"), extractValid("提现账号验证"), shareWeiQuan(
                "分享奖金扣除"), inviteWeiQuan("邀请奖金扣除"), fanliWeiQuan("返利扣除");
        private final String desc;
        private MsgTypeMoneyEnumType(String desc) {
        private MsgTypeMoneyTypeEnum(String desc) {
            this.desc = desc;
        }
@@ -27,19 +32,34 @@
        }
    }
    @Column(name = "mm_id")
    private Long id;
    @Column(name = "mm_uid")
    private UserInfo user;
    private MsgTypeMoneyEnumType msgType;// 消息类型
    @Column(name = "mm_type")
    private MsgTypeMoneyTypeEnum msgType;// 消息类型
    @Column(name = "mm_order_count")
    private Integer orderCount;// 订单数(奖金适用)
    @Column(name = "mm_goods_count")
    private Integer goodsCount;// 商品数
    @Column(name = "mm_order_id")
    private String orderId;// 订单号(返利适用)
    @Column(name = "mm_source_id")
    private Extract extract;// 提现详情
    private AlipayAccountValidNormalHistory alipayAccountValid;// 提现账号验证详情
    @Column(name = "mm_money")
    private BigDecimal money;// 到账资金
    @Column(name = "mm_balance")
    private BigDecimal balance;// 账户余额
    @Column(name = "mm_state_desc")
    private String stateDesc;// 状态说明
    @Column(name = "mm_beizhu")
    private String beiZhu;// 备注
    @Column(name = "mm_create_time")
    private Date createTime;
    @Column(name = "mm_update_time")
    private Date updateTime;
    @Column(name = "mm_read")
    private Boolean read;
    public Long getId() {
@@ -58,11 +78,19 @@
        this.user = user;
    }
    public MsgTypeMoneyEnumType getMsgType() {
    public String getStateDesc() {
        return stateDesc;
    }
    public void setStateDesc(String stateDesc) {
        this.stateDesc = stateDesc;
    }
    public MsgTypeMoneyTypeEnum getMsgType() {
        return msgType;
    }
    public void setMsgType(MsgTypeMoneyEnumType msgType) {
    public void setMsgType(MsgTypeMoneyTypeEnum msgType) {
        this.msgType = msgType;
    }
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOrderDetail.java
@@ -3,6 +3,9 @@
import java.math.BigDecimal;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.entity.bus.user.UserInfo;
/***
@@ -11,6 +14,7 @@
 * @author Administrator
 *
 */
@Table("yeshi_ec_msg_order")
public class MsgOrderDetail {
    public final static int STATE_FK = 1;// 已付款
    public final static int STATE_JS = 2;// 已收货
@@ -30,17 +34,29 @@
        }
    }
    @Column(name = "mo_id")
    private Long id;
    @Column(name = "mo_uid")
    private UserInfo user;
    @Column(name = "mo_type")
    private MsgTypeOrderTypeEnum type;// 消息类型
    @Column(name = "mo_order_id")
    private String orderId;// 订单号
    @Column(name = "mo_state")
    private Integer state;// 状态
    @Column(name = "mo_goods_count")
    private Integer goodsCount;// 商品数量
    @Column(name = "mo_pay_money")
    private BigDecimal payMoney;// 付款金额
    @Column(name = "mo_hongbao_money")
    private BigDecimal hongBaoMoney;// 佣金
    @Column(name = "mo_beizhu")
    private String beiZhu;
    @Column(name = "mo_read")
    private Boolean read;// 是否已读
    @Column(name = "mo_create_time")
    private Date createTime;
    @Column(name = "mo_update_time")
    private Date updateTime;
    public Long getId() {
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/UserMsgUnReadNum.java
@@ -2,20 +2,42 @@
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.entity.bus.user.UserInfo;
/*
 * 用户消息已读状态存储
 */
@Table("yeshi_ec_msg_read_state")
public class UserMsgUnReadNum {
    @Column(name = "mrs_id")
    private Long id;
    private Integer typeOrder;// 订单消息未读数
    private Integer typeMoney;// 资金消息未读数
    private Integer typeAccount;// 账户消息未读数
    private Integer typeInvite;// 邀请消息未读数
    private Integer typeScore;// 积分消息未读数
    @Column(name = "mrs_uid")
    private UserInfo user;
    @Expose
    @Column(name = "mrs_type_order")
    private Integer typeOrder;// 订单消息未读数
    @Expose
    @Column(name = "mrs_type_money")
    private Integer typeMoney;// 资金消息未读数
    @Expose
    @Column(name = "mrs_type_account")
    private Integer typeAccount;// 账户消息未读数
    @Expose
    @Column(name = "mrs_type_invite")
    private Integer typeInvite;// 邀请消息未读数
    @Expose
    @Column(name = "mrs_type_score")
    private Integer typeScore;// 积分消息未读数
    @Expose
    @Column(name = "mrs_type_system")
    private Integer typeSystem;// 系统消息未读数
    @Column(name = "mrs_create_time")
    private Date createTime;
    @Column(name = "mrs_update_time")
    private Date updateTime;
    public Long getId() {
@@ -42,6 +64,14 @@
        this.typeMoney = typeMoney;
    }
    public Integer getTypeSystem() {
        return typeSystem;
    }
    public void setTypeSystem(Integer typeSystem) {
        this.typeSystem = typeSystem;
    }
    public Integer getTypeAccount() {
        return typeAccount;
    }
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/UserSystemMsg.java
@@ -2,6 +2,10 @@
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.google.gson.annotations.Expose;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.system.SystemZnx;
@@ -11,17 +15,40 @@
 * @author Administrator
 *
 */
@Table("yeshi_ec_msg_system")
public class UserSystemMsg {
    public final static int TIME_TAG_COMMON = 0;// 普通
    public final static int TIME_TAG_EMERGENT = 1;// 紧急
    @Expose
    @Column(name = "ms_id")
    private Long id;
    @Column(name = "ms_uid")
    private UserInfo user;
    @Expose
    @Column(name = "ms_type")
    private UserSystemMsgTypeEnum type;// 消息类型
    @Column(name = "ms_system_znx_id")
    private SystemZnx systemZNX;// 系统统一广播的站内信,当有系统站内信时,标题内容等为空
    @Column(name = "ms_read")
    @Expose
    private Boolean read;// 是否已读
    @Expose
    @Column(name = "ms_solved")
    private Boolean solved;// 是否已经解决
    @Column(name = "ms_title")
    @Expose
    private String title;// 标题
    @Column(name = "ms_content")
    @Expose
    private String content;// 内容
    @Column(name = "ms_time_tag")
    @Expose
    private Integer timeTag;// 时间标识:1-紧急 0-普通
    @Expose
    @Column(name = "ms_create_time")
    private Date createTime;
    @Column(name = "ms_update_time")
    private Date updateTime;
    public Long getId() {
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/AlipayAccountValidNormalHistory.java
@@ -26,6 +26,13 @@
    @Column(name = "avnh_createtime")
    private Date createTime;
    public AlipayAccountValidNormalHistory(Long id) {
        this.id = id;
    }
    public AlipayAccountValidNormalHistory() {
    }
    public Long getId() {
        return id;
    }
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/Extract.java
@@ -1,6 +1,7 @@
package com.yeshi.fanli.entity.bus.user;
import java.math.BigDecimal;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -35,6 +36,13 @@
    @Column(name = "`id`")
    private Long id;
    public Extract(Long id) {
        this.id = id;
    }
    public Extract() {
    }
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "uid")
    @org.yeshi.utils.mybatis.Column(name = "uid")
@@ -65,6 +73,17 @@
    @org.yeshi.utils.mybatis.Column(name = "adminId")
    private Long adminId; // 任务id 目前默认值
    // TODO 等待添加字段
    private Date receiveTime;// 到账时间
    public Date getReceiveTime() {
        return receiveTime;
    }
    public void setReceiveTime(Date receiveTime) {
        this.receiveTime = receiveTime;
    }
    public Long getAdminId() {
        return adminId;
    }
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/ThreeSale.java
@@ -27,11 +27,19 @@
    public static int EXPIRE_NORMAL = 0;// 正常状态
    public static int EXPIRE_OUTOFDATE = 1;// 过期状态
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private Long id;
    public ThreeSale(Long id) {
        this.id = id;
    }
    public ThreeSale() {
    }
    @ManyToOne
    @JoinColumn(name = "boss_id")
    @Column(name = "boss_id")
fanli/src/main/java/com/yeshi/fanli/entity/goods/RecommendUserGoods.java
New file
@@ -0,0 +1,75 @@
package com.yeshi.fanli.entity.goods;
import java.util.Date;
import java.util.List;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.entity.bus.user.UserInfo;
/*
 * 用户商品推荐
 */
@Table("yeshi_ec_recommend_user_goods")
public class RecommendUserGoods {
    @Column(name = "rug_id")
    private Long id;
    @Column(name = "rug_uid")
    private UserInfo user;
    @Column(name = "rug_recommend_desc")
    private String recommendDesc;
    @Column(name = "rug_create_time")
    private Date createTime;
    @Column(name = "rug_update_time")
    private Date updateTime;
    private List<CommonGoods> goodsList;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public List<CommonGoods> getGoodsList() {
        return goodsList;
    }
    public void setGoodsList(List<CommonGoods> goodsList) {
        this.goodsList = goodsList;
    }
    public UserInfo getUser() {
        return user;
    }
    public void setUser(UserInfo user) {
        this.user = user;
    }
    public String getRecommendDesc() {
        return recommendDesc;
    }
    public void setRecommendDesc(String recommendDesc) {
        this.recommendDesc = recommendDesc;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/goods/RecommendUserGoodsMap.java
New file
@@ -0,0 +1,67 @@
package com.yeshi.fanli.entity.goods;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/*
 * 用户商品推荐
 */
@Table("yeshi_ec_recommend_user_goods_map")
public class RecommendUserGoodsMap {
    @Column(name = "rugm_id")
    private Long id;
    @Column(name = "rugm_common_goods_id")
    private CommonGoods goods;
    @Column(name = "rugm_recommend_id")
    private RecommendUserGoods recommend;
    @Column(name = "rugm_create_time")
    private Date createTime;
    public RecommendUserGoodsMap(CommonGoods goods, RecommendUserGoods recommend, Date createTime) {
        this.goods = goods;
        this.recommend = recommend;
        this.createTime = createTime;
    }
    public RecommendUserGoodsMap() {
    }
    public RecommendUserGoodsMap(Long id) {
        this.id = id;
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public CommonGoods getGoods() {
        return goods;
    }
    public void setGoods(CommonGoods goods) {
        this.goods = goods;
    }
    public RecommendUserGoods getRecommend() {
        return recommend;
    }
    public void setRecommend(RecommendUserGoods recommend) {
        this.recommend = recommend;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/entity/order/HongBaoOrder.java
@@ -27,7 +27,7 @@
    // 红包ID
    @Column(name = "ho_hongbao_id")
    private HongBaoV2 hongBaoV2;
    // 订单ID
    @Column(name = "ho_order_id")
    private CommonOrder commonOrder;
@@ -35,12 +35,16 @@
    // 创建时间
    @Column(name = "cog_create_time")
    private Date createTime;
    public HongBaoOrder() {
    }
    public HongBaoOrder(CommonOrder commonOrder, HongBaoV2 hongBao) {
        this.commonOrder = commonOrder;
        this.hongBaoV2 = hongBao;
    }
    public HongBaoOrder(Long id) {
        this.id = id;
    }
fanli/src/main/java/com/yeshi/fanli/entity/system/SystemZnx.java
@@ -9,26 +9,31 @@
@Entity
@Table(name = "yeshi_ec_system_msg")
@org.yeshi.utils.mybatis.Table("yeshi_ec_system_msg")
public class SystemZnx {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "id")
    private long id;
    @org.yeshi.utils.mybatis.Column(name="id")
    private Long id;
    
    @Column(name = "`title`", length = 128)
    @org.yeshi.utils.mybatis.Column(name="title")
    private String title;
    
    @Column(name = "`content`", length = 128)
    @org.yeshi.utils.mybatis.Column(name="content")
    private String content;
    
    @Column(name = "`createTime`", length = 128)
    private long createTime;
    @org.yeshi.utils.mybatis.Column(name="createTime")
    private Long createTime;
    public long getId() {
    public Long getId() {
        return id;
    }
    public void setId(long id) {
    public void setId(Long id) {
        this.id = id;
    }
@@ -48,11 +53,11 @@
        this.content = content;
    }
    public long getCreateTime() {
    public Long getCreateTime() {
        return createTime;
    }
    public void setCreateTime(long createTime) {
    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }
fanli/src/main/java/com/yeshi/fanli/exception/goods/RecommendUserGoodsException.java
New file
@@ -0,0 +1,32 @@
package com.yeshi.fanli.exception.goods;
public class RecommendUserGoodsException extends Exception {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private int code;
    private String msg;
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public RecommendUserGoodsException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public RecommendUserGoodsException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli/src/main/java/com/yeshi/fanli/exception/msg/MsgAccountDetailException.java
New file
@@ -0,0 +1,32 @@
package com.yeshi.fanli.exception.msg;
public class MsgAccountDetailException extends Exception {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private int code;
    private String msg;
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public MsgAccountDetailException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public MsgAccountDetailException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli/src/main/java/com/yeshi/fanli/exception/msg/MsgInviteDetailException.java
New file
@@ -0,0 +1,32 @@
package com.yeshi.fanli.exception.msg;
public class MsgInviteDetailException extends Exception {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private int code;
    private String msg;
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public MsgInviteDetailException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public MsgInviteDetailException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli/src/main/java/com/yeshi/fanli/exception/msg/MsgMoneyDetailException.java
New file
@@ -0,0 +1,32 @@
package com.yeshi.fanli.exception.msg;
public class MsgMoneyDetailException extends Exception {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private int code;
    private String msg;
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public MsgMoneyDetailException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public MsgMoneyDetailException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli/src/main/java/com/yeshi/fanli/exception/msg/MsgOrderDetailException.java
New file
@@ -0,0 +1,32 @@
package com.yeshi.fanli.exception.msg;
public class MsgOrderDetailException extends Exception {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private int code;
    private String msg;
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public MsgOrderDetailException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public MsgOrderDetailException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli/src/main/java/com/yeshi/fanli/exception/msg/UserSystemMsgException.java
New file
@@ -0,0 +1,32 @@
package com.yeshi.fanli.exception.msg;
public class UserSystemMsgException extends Exception {
    /**
     *
     */
    private static final long serialVersionUID = 1L;
    private int code;
    private String msg;
    public int getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
    public UserSystemMsgException(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public UserSystemMsgException() {
    }
    @Override
    public String getMessage() {
        return this.msg;
    }
}
fanli/src/main/java/com/yeshi/fanli/job/UpdateThreeSaleJob.java
@@ -9,8 +9,8 @@
import org.springframework.stereotype.Component;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.msg.UserInviteMsgNotificationService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.util.Constant;
@@ -19,6 +19,8 @@
    @Resource
    private ThreeSaleSerivce ThreeSaleSerivce;
    @Resource
    private UserInviteMsgNotificationService userInviteMsgNotificationService;
    @Resource
    private UserInfoService userInfoService;
@@ -43,6 +45,12 @@
            // 更新邀请过期: 60天未被邀请成功、60天未登陆系统
            if (list.size() > 0) {
                ThreeSaleSerivce.updateExpire(list);
                for (Long id : listFailed) {
                    // 通知
                    ThreeSale ts = ThreeSaleSerivce.selectByPrimaryKey(id);
                    if (ts != null)
                        userInviteMsgNotificationService.inviteFail(ts.getBoss().getId(), ts);
                }
            }
        } catch (Exception e) {
fanli/src/main/java/com/yeshi/fanli/mapping/goods/RecommendUserGoodsMapMapper.xml
New file
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.goods.RecommendUserGoodsMapMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.goods.RecommendUserGoodsMap">
        <id column="rugm_id" property="id" jdbcType="BIGINT" />
        <result column="rugm_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <association property="recommend" column="rugm_recommend_id"
            javaType="com.yeshi.fanli.entity.goods.RecommendUserGoods">
            <id column="rugm_recommend_id" property="id" jdbcType="BIGINT" />
        </association>
        <association property="goods" column="rugm_common_goods_id"
            javaType="com.yeshi.fanli.entity.goods.CommonGoods">
            <id column="rugm_common_goods_id" property="id" jdbcType="BIGINT" />
        </association>
    </resultMap>
    <sql id="Base_Column_List">rugm_id,rugm_common_goods_id,rugm_recommend_id,rugm_create_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_recommend_user_goods_map where rugm_id =
        #{id,jdbcType=BIGINT}
    </select>
    <select id="selectGoodsByRecommendId"
        resultMap="com.yeshi.fanli.dao.mybatis.goods.CommonGoodsMapper.BaseResultMap"
        parameterType="java.lang.Long">
        SELECT cg.* FROM `yeshi_ec_recommend_user_goods_map` m
        LEFT JOIN yeshi_ec_common_goods cg ON
        cg.`cg_id`=m.`rugm_common_goods_id` WHERE m.`rugm_recommend_id`=#{id}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_recommend_user_goods_map where rugm_id =
        #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.goods.RecommendUserGoodsMap"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_recommend_user_goods_map
        (rugm_id,rugm_common_goods_id,rugm_recommend_id,rugm_create_time)
        values
        (#{id,jdbcType=BIGINT},#{goods.id,jdbcType=BIGINT},#{recommend.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.goods.RecommendUserGoodsMap"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_recommend_user_goods_map
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">rugm_id,</if>
            <if test="goods != null">rugm_common_goods_id,</if>
            <if test="recommend != null">rugm_recommend_id,</if>
            <if test="createTime != null">rugm_create_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="goods != null">#{goods.id,jdbcType=BIGINT},</if>
            <if test="recommend != null">#{recommend.id,jdbcType=BIGINT},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.goods.RecommendUserGoodsMap">update
        yeshi_ec_recommend_user_goods_map set rugm_common_goods_id =
        #{goods.id,jdbcType=BIGINT},rugm_recommend_id =
        #{recommend.id,jdbcType=BIGINT},rugm_create_time =
        #{createTime,jdbcType=TIMESTAMP} where rugm_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.goods.RecommendUserGoodsMap">
        update yeshi_ec_recommend_user_goods_map
        <set>
            <if test="goods != null">rugm_common_goods_id=#{goods.id,jdbcType=BIGINT},</if>
            <if test="recommend != null">rugm_recommend_id=#{recommend.id,jdbcType=BIGINT},</if>
            <if test="createTime != null">rugm_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
        </set>
        where rugm_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/goods/RecommendUserGoodsMapper.xml
New file
@@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.goods.RecommendUserGoodsMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.goods.RecommendUserGoods">
        <id column="rug_id" property="id" jdbcType="BIGINT" />
        <result column="rug_recommend_desc" property="recommendDesc"
            jdbcType="VARCHAR" />
        <result column="rug_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <result column="rug_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
        <association property="user"
            javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="rug_uid" property="id" jdbcType="BIGINT" />
        </association>
        <association property="goodsList" column="rug_id"
            select="com.yeshi.fanli.dao.mybatis.goods.RecommendUserGoodsMapMapper.selectGoodsByRecommendId">
        </association>
    </resultMap>
    <sql id="Base_Column_List">rug_id,rug_uid,rug_recommend_desc,rug_create_time,rug_update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_recommend_user_goods where rug_id =
        #{id,jdbcType=BIGINT}
    </select>
    <select id="listRecommendGoods" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_recommend_user_goods where rug_uid =
        #{uid,jdbcType=BIGINT} order by rug_create_time desc limit
        #{start},#{count}
    </select>
    <select id="countRecommendGoods" resultType="java.lang.Long"
        parameterType="java.lang.Long">
        select
        count(rug_id)
        from yeshi_ec_recommend_user_goods
        where rug_uid =
        #{uid,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_recommend_user_goods where rug_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.goods.RecommendUserGoods"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_recommend_user_goods
        (rug_id,rug_uid,rug_recommend_desc,rug_create_time,rug_update_time)
        values
        (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{recommendDesc,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.goods.RecommendUserGoods"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_recommend_user_goods
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">rug_id,</if>
            <if test="user != null">rug_uid,</if>
            <if test="recommendDesc != null">rug_recommend_desc,</if>
            <if test="createTime != null">rug_create_time,</if>
            <if test="updateTime != null">rug_update_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="user != null">#{user.id,jdbcType=BIGINT},</if>
            <if test="recommendDesc != null">#{recommendDesc,jdbcType=VARCHAR},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.goods.RecommendUserGoods">update
        yeshi_ec_recommend_user_goods set rug_uid =
        #{user.id,jdbcType=BIGINT},rug_recommend_desc =
        #{recommendDesc,jdbcType=VARCHAR},rug_create_time =
        #{createTime,jdbcType=TIMESTAMP},rug_update_time =
        #{updateTime,jdbcType=TIMESTAMP} where rug_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.goods.RecommendUserGoods">
        update yeshi_ec_recommend_user_goods
        <set>
            <if test="user != null">rug_uid=#{user.id,jdbcType=BIGINT},</if>
            <if test="recommendDesc != null">rug_recommend_desc=#{recommendDesc,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">rug_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">rug_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where rug_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgAccountDetailMapper.xml
New file
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.msg.MsgAccountDetailMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.bus.msg.MsgAccountDetail">
        <id column="ma_id" property="id" jdbcType="BIGINT" />
        <result column="ma_type" property="type"
            typeHandler="com.yeshi.fanli.util.mybatishandler.msg.MsgTypeAccountTypeEnumHandler" />
        <result column="ma_title" property="title" jdbcType="VARCHAR" />
        <result column="ma_content" property="content" jdbcType="VARCHAR" />
        <result column="ma_beizhu" property="beiZhu" jdbcType="VARCHAR" />
        <result column="ma_read" property="read" jdbcType="BOOLEAN" />
        <result column="ma_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="ma_update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <association property="user" column="ma_uid"
            javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="ma_uid" property="id" jdbcType="BIGINT" />
        </association>
    </resultMap>
    <sql id="Base_Column_List">ma_id,ma_uid,ma_type,ma_title,ma_content,ma_beizhu,ma_read,ma_create_time,ma_update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_account where ma_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="listByUid" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_account where ma_uid = #{uid,jdbcType=BIGINT} order
        by ma_update_time desc limit #{start},#{count}
    </select>
    <select id="countByUid" resultType="java.lang.Long"
        parameterType="java.lang.Long">
        select
        count(ma_id)
        from yeshi_ec_msg_account where ma_uid
        = #{uid,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_msg_account where ma_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.MsgAccountDetail"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_msg_account
        (ma_id,ma_uid,ma_type,ma_title,ma_content,ma_beizhu,ma_read,ma_create_time,ma_update_time)
        values
        (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{beiZhu,jdbcType=VARCHAR},#{read,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgAccountDetail"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_msg_account
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">ma_id,</if>
            <if test="user != null">ma_uid,</if>
            <if test="type != null">ma_type,</if>
            <if test="title != null">ma_title,</if>
            <if test="content != null">ma_content,</if>
            <if test="beiZhu != null">ma_beizhu,</if>
            <if test="read != null">ma_read,</if>
            <if test="createTime != null">ma_create_time,</if>
            <if test="updateTime != null">ma_update_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="user != null">#{user.id,jdbcType=BIGINT},</if>
            <if test="type != null">#{type,jdbcType=VARCHAR},</if>
            <if test="title != null">#{title,jdbcType=VARCHAR},</if>
            <if test="content != null">#{content,jdbcType=VARCHAR},</if>
            <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if>
            <if test="read != null">#{read,jdbcType=BOOLEAN},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.MsgAccountDetail">update
        yeshi_ec_msg_account set ma_uid = #{user.id,jdbcType=BIGINT},ma_type
        =
        #{type,jdbcType=VARCHAR},ma_title =
        #{title,jdbcType=VARCHAR},ma_content =
        #{content,jdbcType=VARCHAR},ma_beizhu =
        #{beiZhu,jdbcType=VARCHAR},ma_read =
        #{read,jdbcType=BOOLEAN},ma_create_time =
        #{createTime,jdbcType=TIMESTAMP},ma_update_time =
        #{updateTime,jdbcType=TIMESTAMP} where ma_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgAccountDetail">
        update yeshi_ec_msg_account
        <set>
            <if test="user != null">ma_uid=#{user.id,jdbcType=BIGINT},</if>
            <if test="type != null">ma_type=#{type,jdbcType=VARCHAR},</if>
            <if test="title != null">ma_title=#{title,jdbcType=VARCHAR},</if>
            <if test="content != null">ma_content=#{content,jdbcType=VARCHAR},</if>
            <if test="beiZhu != null">ma_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
            <if test="read != null">ma_read=#{read,jdbcType=BOOLEAN},</if>
            <if test="createTime != null">ma_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">ma_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where ma_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="setMsgReadByUid" parameterType="java.lang.Long">
        update
        yeshi_ec_msg_account set ma_read=1 where ma_uid=#{0}
    </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgInviteDetailMapper.xml
New file
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.msg.MsgInviteDetailMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.bus.msg.MsgInviteDetail">
        <id column="mi_id" property="id" jdbcType="BIGINT" />
        <result column="mi_type" property="msgType"
            typeHandler="com.yeshi.fanli.util.mybatishandler.msg.MsgTypeInviteTypeEnumHandler" />
        <result column="mi_desc" property="desc" jdbcType="VARCHAR" />
        <result column="mi_beizhu" property="beiZhu" jdbcType="VARCHAR" />
        <result column="mi_read" property="read" jdbcType="BOOLEAN" />
        <result column="mi_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="mi_update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <association property="inviteUser" column="mi_invite_id"
            javaType="com.yeshi.fanli.entity.bus.user.ThreeSale">
            <id column="mi_invite_id" property="id" jdbcType="BIGINT" />
            <id column="state" property="state" jdbcType="BOOLEAN" />
            <id column="expire" property="expire" jdbcType="INTEGER" />
            <association property="boss" column="boss_id"
                javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
                <id column="boss_id" property="id" jdbcType="BIGINT" />
            </association>
            <association property="worker" column="worker_id"
                javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
                <id column="worker_id" property="id" jdbcType="BIGINT" />
                <result column="nick_name" property="nickName" jdbcType="VARCHAR" />
                <result column="portrait" property="portrait" jdbcType="VARCHAR" />
            </association>
        </association>
        <association property="user" column="mi_uid"
            javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="mi_uid" property="id" jdbcType="BIGINT" />
        </association>
    </resultMap>
    <sql id="Base_Column_List">mi_id,mi_uid,mi_type,mi_invite_id,mi_desc,mi_beizhu,mi_read,mi_create_time,mi_update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_invite where mi_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByThreeSaleId" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        ,
        t.*
        from yeshi_ec_msg_invite left join yeshi_ec_threesale t on
        t.id=mi_invite_id where mi_invite_id = #{0}
    </select>
    <select id="listByUid" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        ,u.`id`,u.`nick_name`,u.`portrait` FROM yeshi_ec_msg_invite i LEFT
        JOIN yeshi_ec_threesale t ON t.`id`=i.`mi_invite_id` LEFT JOIN
        yeshi_ec_user u ON u.`id`=t.`worker_id` where mi_uid = #{uid} order by
        mi_update_time desc limit #{start},#{count}
    </select>
    <select id="countByUid" resultType="java.lang.Long"
        parameterType="java.lang.Long">
        select
        count(mi_id)
        from yeshi_ec_msg_invite where mi_uid=
        #{uid}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_msg_invite where mi_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.MsgInviteDetail"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_msg_invite
        (mi_id,mi_uid,mi_type,mi_invite_id,mi_desc,mi_beizhu,mi_read,mi_create_time,mi_update_time)
        values
        (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{msgType,jdbcType=VARCHAR},#{inviteUser.id,jdbcType=BIGINT},#{desc,jdbcType=VARCHAR},#{beiZhu,jdbcType=VARCHAR},#{read,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgInviteDetail"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_msg_invite
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">mi_id,</if>
            <if test="user != null">mi_uid,</if>
            <if test="msgType != null">mi_type,</if>
            <if test="inviteUser != null">mi_invite_id,</if>
            <if test="desc != null">mi_desc,</if>
            <if test="beiZhu != null">mi_beizhu,</if>
            <if test="read != null">mi_read,</if>
            <if test="createTime != null">mi_create_time,</if>
            <if test="updateTime != null">mi_update_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="user != null">#{user.id,jdbcType=BIGINT},</if>
            <if test="msgType != null">#{msgType,jdbcType=VARCHAR},</if>
            <if test="inviteUser != null">#{inviteUser.id,jdbcType=BIGINT},</if>
            <if test="desc != null">#{desc,jdbcType=VARCHAR},</if>
            <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if>
            <if test="read != null">#{read,jdbcType=BOOLEAN},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.MsgInviteDetail">update
        yeshi_ec_msg_invite set mi_uid = #{user.id,jdbcType=BIGINT},mi_type =
        #{msgType,jdbcType=VARCHAR},mi_invite_id =
        #{inviteUser.id,jdbcType=BIGINT},mi_desc =
        #{desc,jdbcType=VARCHAR},mi_beizhu =
        #{beiZhu,jdbcType=VARCHAR},mi_read =
        #{read,jdbcType=BOOLEAN},mi_create_time =
        #{createTime,jdbcType=TIMESTAMP},mi_update_time =
        #{updateTime,jdbcType=TIMESTAMP} where mi_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgInviteDetail">
        update yeshi_ec_msg_invite
        <set>
            <if test="user != null">mi_uid=#{user.id,jdbcType=BIGINT},</if>
            <if test="msgType != null">mi_type=#{msgType,jdbcType=VARCHAR},</if>
            <if test="inviteUser != null">mi_invite_id=#{inviteUser.id,jdbcType=BIGINT},</if>
            <if test="desc != null">mi_desc=#{desc,jdbcType=VARCHAR},</if>
            <if test="beiZhu != null">mi_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
            <if test="read != null">mi_read=#{read,jdbcType=BOOLEAN},</if>
            <if test="createTime != null">mi_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">mi_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where mi_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="setMsgReadByUid" parameterType="java.lang.Long">
        update
        yeshi_ec_msg_invite set mi_read=1 where mi_uid=#{0}
    </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgMoneyDetailMapper.xml
New file
@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.msg.MsgMoneyDetailMapper">
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail">
        <id column="mm_id" property="id" jdbcType="BIGINT" />
        <result column="mm_type" property="msgType"
            typeHandler="com.yeshi.fanli.util.mybatishandler.msg.MsgTypeMoneyTypeEnumHandler" />
        <result column="mm_order_count" property="orderCount" jdbcType="INTEGER" />
        <result column="mm_goods_count" property="goodsCount" jdbcType="INTEGER" />
        <result column="mm_order_id" property="orderId" jdbcType="VARCHAR" />
        <result column="mm_money" property="money" jdbcType="DECIMAL" />
        <result column="mm_balance" property="balance" jdbcType="DECIMAL" />
        <result column="mm_state_desc" property="stateDesc" jdbcType="VARCHAR" />
        <result column="mm_beizhu" property="beiZhu" jdbcType="VARCHAR" />
        <result column="mm_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="mm_update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <result column="mm_read" property="read" jdbcType="BOOLEAN" />
        <association property="user" column="mm_uid"  javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="mm_uid" property="id" jdbcType="BIGINT" />
        </association>
        <association property="extract" column="mm_source_id_extract"
            select="com.yeshi.fanli.dao.mybatis.ExtractMapper.selectByPrimaryKey">
        </association>
        <association property="alipayAccountValid" column="mm_source_id_alipayvalid"
            select="com.yeshi.fanli.dao.mybatis.AlipayAccountValidNormalHistoryMapper.selectByPrimaryKey">
        </association>
    </resultMap>
    <sql id="Base_Column_List">mm_id,mm_uid,mm_type,mm_order_count,mm_goods_count,mm_order_id,mm_source_id,mm_money,mm_balance,mm_state_desc,mm_beizhu,mm_create_time,mm_update_time,mm_read
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_money where mm_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectBySourceIdAndMsgType" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_money where mm_source_id =
        #{sourceId,jdbcType=BIGINT} and mm_type=#{type}
    </select>
    <select id="listByUid" resultMap="BaseResultMap" >
        select
        <include refid="Base_Column_List" />,
        mm_source_id as mm_source_id_extract,
        mm_source_id as mm_source_id_alipayvalid
        from yeshi_ec_msg_money where mm_uid = #{uid,jdbcType=BIGINT} order by
        mm_update_time desc limit #{start},#{count}
    </select>
    <select id="countByUid" resultType="java.lang.Long"
        parameterType="java.lang.Long">
        select
        count(mm_id)
        from yeshi_ec_msg_money where mm_uid =
        #{uid,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_msg_money where mm_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_msg_money
        (mm_id,mm_uid,mm_type,mm_order_count,mm_goods_count,mm_order_id,mm_source_id,mm_money,mm_balance,mm_state_desc,mm_beizhu,mm_create_time,mm_update_time,mm_read)
        values
        (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{msgType,jdbcType=VARCHAR},#{orderCount,jdbcType=INTEGER},#{goodsCount,jdbcType=INTEGER},#{orderId,jdbcType=VARCHAR},#{extract.id,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{balance,jdbcType=DECIMAL},#{stateDesc,jdbcType=VARCHAR},#{beiZhu,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{read,jdbcType=BOOLEAN})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_msg_money
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">mm_id,</if>
            <if test="user != null">mm_uid,</if>
            <if test="msgType != null">mm_type,</if>
            <if test="orderCount != null">mm_order_count,</if>
            <if test="goodsCount != null">mm_goods_count,</if>
            <if test="orderId != null">mm_order_id,</if>
            <if test="extract != null">mm_source_id,</if>
            <if test="alipayAccountValid != null">mm_source_id,</if>
            <if test="money != null">mm_money,</if>
            <if test="balance != null">mm_balance,</if>
            <if test="stateDesc != null">mm_state_desc,</if>
            <if test="beiZhu != null">mm_beizhu,</if>
            <if test="createTime != null">mm_create_time,</if>
            <if test="updateTime != null">mm_update_time,</if>
            <if test="read != null">mm_read,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="user != null">#{user.id,jdbcType=BIGINT},</if>
            <if test="msgType != null">#{msgType,jdbcType=VARCHAR},</if>
            <if test="orderCount != null">#{orderCount,jdbcType=INTEGER},</if>
            <if test="goodsCount != null">#{goodsCount,jdbcType=INTEGER},</if>
            <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if>
            <if test="extract != null">#{extract.id,jdbcType=BIGINT},</if>
            <if test="alipayAccountValid != null">#{alipayAccountValid.id,jdbcType=BIGINT},</if>
            <if test="money != null">#{money,jdbcType=DECIMAL},</if>
            <if test="balance != null">#{balance,jdbcType=DECIMAL},</if>
            <if test="stateDesc != null">#{stateDesc,jdbcType=VARCHAR},</if>
            <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="read != null">#{read,jdbcType=BOOLEAN},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail">update
        yeshi_ec_msg_money set mm_uid = #{user.id,jdbcType=BIGINT},mm_type =
        #{msgType,jdbcType=VARCHAR},mm_order_count =
        #{orderCount,jdbcType=INTEGER},mm_goods_count =
        #{goodsCount,jdbcType=INTEGER},mm_order_id =
        #{orderId,jdbcType=VARCHAR},mm_source_id =
        #{extract.id,jdbcType=BIGINT},mm_money =
        #{money,jdbcType=DECIMAL},mm_balance =
        #{balance,jdbcType=DECIMAL},mm_state_desc =
        #{stateDesc,jdbcType=VARCHAR},mm_beizhu =
        #{beiZhu,jdbcType=VARCHAR},mm_create_time =
        #{createTime,jdbcType=TIMESTAMP},mm_update_time =
        #{updateTime,jdbcType=TIMESTAMP},mm_read = #{read,jdbcType=BOOLEAN}
        where mm_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail">
        update yeshi_ec_msg_money
        <set>
            <if test="user != null">mm_uid=#{user.id,jdbcType=BIGINT},</if>
            <if test="msgType != null">mm_type=#{msgType,jdbcType=VARCHAR},</if>
            <if test="orderCount != null">mm_order_count=#{orderCount,jdbcType=INTEGER},</if>
            <if test="goodsCount != null">mm_goods_count=#{goodsCount,jdbcType=INTEGER},</if>
            <if test="orderId != null">mm_order_id=#{orderId,jdbcType=VARCHAR},</if>
            <if test="extract != null">mm_source_id=#{extract.id,jdbcType=BIGINT},</if>
            <if test="alipayAccountValid != null">mm_source_id=#{alipayAccountValid.id,jdbcType=BIGINT},
            </if>
            <if test="money != null">mm_money=#{money,jdbcType=DECIMAL},</if>
            <if test="balance != null">mm_balance=#{balance,jdbcType=DECIMAL},</if>
            <if test="stateDesc != null">mm_state_desc=#{stateDesc,jdbcType=VARCHAR},</if>
            <if test="beiZhu != null">mm_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
            <if test="createTime != null">mm_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">mm_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="read != null">mm_read=#{read,jdbcType=BOOLEAN},</if>
        </set>
        where mm_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="setMsgReadByUid" parameterType="java.lang.Long">
        update
        yeshi_ec_msg_money set mm_read=1 where mm_uid=#{0}
    </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgOrderDetailMapper.xml
New file
@@ -0,0 +1,143 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.msg.MsgOrderDetailMapper">
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.msg.MsgOrderDetail">
        <id column="mo_id" property="id" jdbcType="BIGINT" />
        <result column="mo_type" property="type"
            typeHandler="com.yeshi.fanli.util.mybatishandler.msg.MsgTypeOrderTypeEnumHandler" />
        <result column="mo_order_id" property="orderId" jdbcType="VARCHAR" />
        <result column="mo_state" property="state" jdbcType="INTEGER" />
        <result column="mo_goods_count" property="goodsCount" jdbcType="INTEGER" />
        <result column="mo_pay_money" property="payMoney" jdbcType="DECIMAL" />
        <result column="mo_hongbao_money" property="hongBaoMoney"
            jdbcType="DECIMAL" />
        <result column="mo_beizhu" property="beiZhu" jdbcType="VARCHAR" />
        <result column="mo_read" property="read" jdbcType="BOOLEAN" />
        <result column="mo_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="mo_update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <association property="user" column="mo_uid" javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="mo_uid" property="id" jdbcType="BIGINT" />
        </association>
    </resultMap>
    <sql id="Base_Column_List">mo_id,mo_uid,mo_type,mo_order_id,mo_state,mo_goods_count,mo_pay_money,mo_hongbao_money,mo_beizhu,mo_read,mo_create_time,mo_update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_order where mo_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByUidAndOrderId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_order where mo_uid = #{uid,jdbcType=BIGINT} and
        mo_order_id=#{orderId}
    </select>
    <select id="listByOrderId" resultMap="BaseResultMap" parameterType="java.lang.String">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_order where mo_order_id = #{orderId}
    </select>
    <select id="listByUid" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_order where mo_uid = #{uid,jdbcType=BIGINT} order by
        mo_update_time desc limit #{start},#{count}
    </select>
    <select id="countByUid" resultType="java.lang.Long"
        parameterType="java.lang.Long">
        select
        count(mo_id)
        from yeshi_ec_msg_order where mo_uid =
        #{uid,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_msg_order where mo_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.MsgOrderDetail"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_msg_order
        (mo_id,mo_uid,mo_type,mo_order_id,mo_state,mo_goods_count,mo_pay_money,mo_hongbao_money,mo_beizhu,mo_read,mo_create_time,mo_update_time)
        values
        (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{orderId,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{goodsCount,jdbcType=INTEGER},#{payMoney,jdbcType=DECIMAL},#{hongBaoMoney,jdbcType=DECIMAL},#{beiZhu,jdbcType=VARCHAR},#{read,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgOrderDetail"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_msg_order
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">mo_id,</if>
            <if test="user != null">mo_uid,</if>
            <if test="type != null">mo_type,</if>
            <if test="orderId != null">mo_order_id,</if>
            <if test="state != null">mo_state,</if>
            <if test="goodsCount != null">mo_goods_count,</if>
            <if test="payMoney != null">mo_pay_money,</if>
            <if test="hongBaoMoney != null">mo_hongbao_money,</if>
            <if test="beiZhu != null">mo_beizhu,</if>
            <if test="read != null">mo_read,</if>
            <if test="createTime != null">mo_create_time,</if>
            <if test="updateTime != null">mo_update_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="user != null">#{user.id,jdbcType=BIGINT},</if>
            <if test="type != null">#{type,jdbcType=VARCHAR},</if>
            <if test="orderId != null">#{orderId,jdbcType=VARCHAR},</if>
            <if test="state != null">#{state,jdbcType=INTEGER},</if>
            <if test="goodsCount != null">#{goodsCount,jdbcType=INTEGER},</if>
            <if test="payMoney != null">#{payMoney,jdbcType=DECIMAL},</if>
            <if test="hongBaoMoney != null">#{hongBaoMoney,jdbcType=DECIMAL},</if>
            <if test="beiZhu != null">#{beiZhu,jdbcType=VARCHAR},</if>
            <if test="read != null">#{read,jdbcType=BOOLEAN},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.MsgOrderDetail">update
        yeshi_ec_msg_order set mo_uid = #{user.id,jdbcType=BIGINT},mo_type =
        #{type,jdbcType=VARCHAR},mo_order_id =
        #{orderId,jdbcType=VARCHAR},mo_state =
        #{state,jdbcType=INTEGER},mo_goods_count =
        #{goodsCount,jdbcType=INTEGER},mo_pay_money =
        #{payMoney,jdbcType=DECIMAL},mo_hongbao_money =
        #{hongBaoMoney,jdbcType=DECIMAL},mo_beizhu =
        #{beiZhu,jdbcType=VARCHAR},mo_read =
        #{read,jdbcType=BOOLEAN},mo_create_time =
        #{createTime,jdbcType=TIMESTAMP},mo_update_time =
        #{updateTime,jdbcType=TIMESTAMP} where mo_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgOrderDetail">
        update yeshi_ec_msg_order
        <set>
            <if test="user != null">mo_uid=#{user.id,jdbcType=BIGINT},</if>
            <if test="type != null">mo_type=#{type,jdbcType=VARCHAR},</if>
            <if test="orderId != null">mo_order_id=#{orderId,jdbcType=VARCHAR},</if>
            <if test="state != null">mo_state=#{state,jdbcType=INTEGER},</if>
            <if test="goodsCount != null">mo_goods_count=#{goodsCount,jdbcType=INTEGER},</if>
            <if test="payMoney != null">mo_pay_money=#{payMoney,jdbcType=DECIMAL},</if>
            <if test="hongBaoMoney != null">mo_hongbao_money=#{hongBaoMoney,jdbcType=DECIMAL},</if>
            <if test="beiZhu != null">mo_beizhu=#{beiZhu,jdbcType=VARCHAR},</if>
            <if test="read != null">mo_read=#{read,jdbcType=BOOLEAN},</if>
            <if test="createTime != null">mo_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">mo_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where mo_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="setMsgReadByUid" parameterType="java.lang.Long">
        update
        yeshi_ec_msg_order set mo_read=1 where mo_uid=#{0}
    </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/msg/SystemZnxMapper.xml
New file
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.msg.SystemZnxMapper">
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.system.SystemZnx">
        <id column="id" property="id" jdbcType="BIGINT" />
        <result column="title" property="title" jdbcType="VARCHAR" />
        <result column="content" property="content" jdbcType="VARCHAR" />
        <result column="createTime" property="createTime" jdbcType="BIGINT" />
    </resultMap>
    <sql id="Base_Column_List">id,title,content,createTime</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_system_msg where id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_system_msg where id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.system.SystemZnx"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_system_msg
        (id,title,content,createTime) values
        (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{createTime,jdbcType=BIGINT})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.system.SystemZnx"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_system_msg
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="title != null">title,</if>
            <if test="content != null">content,</if>
            <if test="createTime != null">createTime,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="title != null">#{title,jdbcType=VARCHAR},</if>
            <if test="content != null">#{content,jdbcType=VARCHAR},</if>
            <if test="createTime != null">#{createTime,jdbcType=BIGINT},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.system.SystemZnx">update
        yeshi_ec_system_msg set title = #{title,jdbcType=VARCHAR},content =
        #{content,jdbcType=VARCHAR},createTime = #{createTime,jdbcType=BIGINT}
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.system.SystemZnx">
        update yeshi_ec_system_msg
        <set>
            <if test="title != null">title=#{title,jdbcType=VARCHAR},</if>
            <if test="content != null">content=#{content,jdbcType=VARCHAR},</if>
            <if test="createTime != null">createTime=#{createTime,jdbcType=BIGINT},</if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/msg/UserMsgUnReadNumMapper.xml
New file
@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.msg.UserMsgUnReadNumMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum">
        <id column="mrs_id" property="id" jdbcType="BIGINT" />
        <result column="mrs_type_order" property="typeOrder" jdbcType="INTEGER" />
        <result column="mrs_type_money" property="typeMoney" jdbcType="INTEGER" />
        <result column="mrs_type_account" property="typeAccount"
            jdbcType="INTEGER" />
        <result column="mrs_type_invite" property="typeInvite"
            jdbcType="INTEGER" />
        <result column="mrs_type_score" property="typeScore" jdbcType="INTEGER" />
        <result column="mrs_type_system" property="typeSystem"
            jdbcType="INTEGER" />
        <result column="mrs_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <result column="mrs_update_time" property="updateTime"
            jdbcType="TIMESTAMP" />
        <association property="user" column="mrs_uid" javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="mrs_uid" property="id" jdbcType="BIGINT" />
        </association>
    </resultMap>
    <sql id="Base_Column_List">mrs_id,mrs_uid,mrs_type_order,mrs_type_money,mrs_type_account,mrs_type_invite,mrs_type_score,mrs_type_system,mrs_create_time,mrs_update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_read_state where mrs_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByUid" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_read_state where mrs_uid = #{uid,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_msg_read_state where mrs_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_msg_read_state
        (mrs_id,mrs_uid,mrs_type_order,mrs_type_money,mrs_type_account,mrs_type_invite,mrs_type_score,mrs_type_system,mrs_create_time,mrs_update_time)
        values
        (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{typeOrder,jdbcType=INTEGER},#{typeMoney,jdbcType=INTEGER},#{typeAccount,jdbcType=INTEGER},#{typeInvite,jdbcType=INTEGER},#{typeScore,jdbcType=INTEGER},#{typeSystem,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_msg_read_state
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">mrs_id,</if>
            <if test="user != null">mrs_uid,</if>
            <if test="typeOrder != null">mrs_type_order,</if>
            <if test="typeMoney != null">mrs_type_money,</if>
            <if test="typeAccount != null">mrs_type_account,</if>
            <if test="typeInvite != null">mrs_type_invite,</if>
            <if test="typeScore != null">mrs_type_score,</if>
            <if test="typeSystem != null">mrs_type_system,</if>
            <if test="createTime != null">mrs_create_time,</if>
            <if test="updateTime != null">mrs_update_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="user != null">#{user.id,jdbcType=BIGINT},</if>
            <if test="typeOrder != null">#{typeOrder,jdbcType=INTEGER},</if>
            <if test="typeMoney != null">#{typeMoney,jdbcType=INTEGER},</if>
            <if test="typeAccount != null">#{typeAccount,jdbcType=INTEGER},</if>
            <if test="typeInvite != null">#{typeInvite,jdbcType=INTEGER},</if>
            <if test="typeScore != null">#{typeScore,jdbcType=INTEGER},</if>
            <if test="typeSystem != null">#{typeSystem,jdbcType=INTEGER},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum">update
        yeshi_ec_msg_read_state set mrs_uid =
        #{user.id,jdbcType=BIGINT},mrs_type_order =
        #{typeOrder,jdbcType=INTEGER},mrs_type_money =
        #{typeMoney,jdbcType=INTEGER},mrs_type_account =
        #{typeAccount,jdbcType=INTEGER},mrs_type_invite =
        #{typeInvite,jdbcType=INTEGER},mrs_type_score =
        #{typeScore,jdbcType=INTEGER},mrs_type_system =
        #{typeSystem,jdbcType=INTEGER},mrs_create_time =
        #{createTime,jdbcType=TIMESTAMP},mrs_update_time =
        #{updateTime,jdbcType=TIMESTAMP} where mrs_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum">
        update yeshi_ec_msg_read_state
        <set>
            <if test="user != null">mrs_uid=#{user.id,jdbcType=BIGINT},</if>
            <if test="typeOrder != null">mrs_type_order=#{typeOrder,jdbcType=INTEGER},</if>
            <if test="typeMoney != null">mrs_type_money=#{typeMoney,jdbcType=INTEGER},</if>
            <if test="typeAccount != null">mrs_type_account=#{typeAccount,jdbcType=INTEGER},</if>
            <if test="typeInvite != null">mrs_type_invite=#{typeInvite,jdbcType=INTEGER},</if>
            <if test="typeScore != null">mrs_type_score=#{typeScore,jdbcType=INTEGER},</if>
            <if test="typeSystem != null">mrs_type_system=#{typeSystem,jdbcType=INTEGER},</if>
            <if test="createTime != null">mrs_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">mrs_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where mrs_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/mapping/msg/UserSystemMsgMapper.xml
New file
@@ -0,0 +1,149 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.msg.UserSystemMsgMapper">
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.msg.UserSystemMsg">
        <id column="ms_id" property="id" jdbcType="BIGINT" />
        <result column="ms_type" property="type"
            typeHandler="com.yeshi.fanli.util.mybatishandler.msg.UserSystemMsgTypeEnumHandler" />
        <result column="ms_read" property="read" jdbcType="BOOLEAN" />
        <result column="ms_solved" property="solved" jdbcType="BOOLEAN" />
        <result column="ms_title" property="title" jdbcType="VARCHAR" />
        <result column="ms_content" property="content" jdbcType="VARCHAR" />
        <result column="ms_time_tag" property="timeTag" jdbcType="INTEGER" />
        <result column="ms_create_time" property="createTime" jdbcType="TIMESTAMP" />
        <result column="ms_update_time" property="updateTime" jdbcType="TIMESTAMP" />
        <association property="user" column="ms_uid"
            javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
            <id column="ms_uid" property="id" jdbcType="BIGINT" />
        </association>
        <association property="systemZNX" column="ms_system_znx_id"
            select="com.yeshi.fanli.dao.mybatis.msg.SystemZnxMapper.selectByPrimaryKey">
        </association>
    </resultMap>
    <sql id="Base_Column_List">ms_id,ms_uid,ms_type,ms_system_znx_id,ms_read,ms_solved,ms_title,ms_content,ms_time_tag,ms_create_time,ms_update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_msg_system where ms_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="listByUid" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_msg_system where ms_uid = #{uid,jdbcType=BIGINT}
        order by ms_create_time desc limit #{start},#{count}
    </select>
    <select id="countByUid" resultType="java.lang.Long"
        parameterType="java.lang.Long">
        select
        count(ms_id)
        from yeshi_ec_user_msg_system where
        ms_uid =
        #{uid,jdbcType=BIGINT}
    </select>
    <select id="selectBySystemZNXId" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_msg_system where ms_system_znx_id =
        #{id,jdbcType=BIGINT}
    </select>
    <select id="selectLatestUserSystemMsg" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_msg_system where ms_uid = #{uid} order by
        ms_create_time desc limit 1
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_user_msg_system where ms_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.UserSystemMsg"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_user_msg_system
        (ms_id,ms_uid,ms_type,ms_system_znx_id,ms_read,ms_solved,ms_title,ms_content,ms_time_tag,ms_create_time,ms_update_time)
        values
        (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{systemZNX.id,jdbcType=BIGINT},#{read,jdbcType=BOOLEAN},#{solved,jdbcType=BOOLEAN},#{title,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{timeTag,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.UserSystemMsg"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_user_msg_system
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">ms_id,</if>
            <if test="user != null">ms_uid,</if>
            <if test="type != null">ms_type,</if>
            <if test="systemZNX != null">ms_system_znx_id,</if>
            <if test="read != null">ms_read,</if>
            <if test="solved != null">ms_solved,</if>
            <if test="title != null">ms_title,</if>
            <if test="content != null">ms_content,</if>
            <if test="timeTag != null">ms_time_tag,</if>
            <if test="createTime != null">ms_create_time,</if>
            <if test="updateTime != null">ms_update_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="user != null">#{user.id,jdbcType=BIGINT},</if>
            <if test="type != null">#{type,jdbcType=VARCHAR},</if>
            <if test="systemZNX != null">#{systemZNX.id,jdbcType=BIGINT},</if>
            <if test="read != null">#{read,jdbcType=BOOLEAN},</if>
            <if test="solved != null">#{solved,jdbcType=BOOLEAN},</if>
            <if test="title != null">#{title,jdbcType=VARCHAR},</if>
            <if test="content != null">#{content,jdbcType=VARCHAR},</if>
            <if test="timeTag != null">#{timeTag,jdbcType=INTEGER},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.UserSystemMsg">update
        yeshi_ec_user_msg_system set ms_uid =
        #{user.id,jdbcType=BIGINT},ms_type =
        #{type,jdbcType=VARCHAR},ms_system_znx_id =
        #{systemZNX.id,jdbcType=BIGINT},ms_read =
        #{read,jdbcType=BOOLEAN},ms_solved =
        #{solved,jdbcType=BOOLEAN},ms_title =
        #{title,jdbcType=VARCHAR},ms_content =
        #{content,jdbcType=VARCHAR},ms_time_tag =
        #{timeTag,jdbcType=INTEGER},ms_create_time =
        #{createTime,jdbcType=TIMESTAMP},ms_update_time =
        #{updateTime,jdbcType=TIMESTAMP} where ms_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.UserSystemMsg">
        update yeshi_ec_user_msg_system
        <set>
            <if test="user != null">ms_uid=#{user.id,jdbcType=BIGINT},</if>
            <if test="type != null">ms_type=#{type,jdbcType=VARCHAR},</if>
            <if test="systemZNX != null">ms_system_znx_id=#{systemZNX.id,jdbcType=BIGINT},</if>
            <if test="read != null">ms_read=#{read,jdbcType=BOOLEAN},</if>
            <if test="solved != null">ms_solved=#{solved,jdbcType=BOOLEAN},</if>
            <if test="title != null">ms_title=#{title,jdbcType=VARCHAR},</if>
            <if test="content != null">ms_content=#{content,jdbcType=VARCHAR},</if>
            <if test="timeTag != null">ms_time_tag=#{timeTag,jdbcType=INTEGER},</if>
            <if test="createTime != null">ms_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">ms_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
        </set>
        where ms_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="setMsgReadByUid" parameterType="java.lang.Long">
        update
        yeshi_ec_user_msg_system set ms_read=1 where ms_uid=#{0}
    </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/goods/RecommendUserGoodsServiceImpl.java
New file
@@ -0,0 +1,63 @@
package com.yeshi.fanli.service.impl.goods;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.dao.mybatis.goods.RecommendUserGoodsMapMapper;
import com.yeshi.fanli.dao.mybatis.goods.RecommendUserGoodsMapper;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.goods.RecommendUserGoods;
import com.yeshi.fanli.entity.goods.RecommendUserGoodsMap;
import com.yeshi.fanli.exception.goods.CommonGoodsException;
import com.yeshi.fanli.exception.goods.RecommendUserGoodsException;
import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
import com.yeshi.fanli.service.inter.goods.RecommendUserGoodsService;
@Service
public class RecommendUserGoodsServiceImpl implements RecommendUserGoodsService {
    @Resource
    private RecommendUserGoodsMapper recommendUserGoodsMapper;
    @Resource
    private RecommendUserGoodsMapMapper recommendUserGoodsMapMapper;
    @Resource
    private CommonGoodsService commonGoodsService;
    @Transactional
    @Override
    public void addRecommend(Long uid, String recommendDesc, List<CommonGoods> goodsList)
            throws RecommendUserGoodsException {
        if (goodsList == null || goodsList.size() == 0)
            throw new RecommendUserGoodsException(1, "无推荐商品");
        RecommendUserGoods goods = new RecommendUserGoods();
        goods.setCreateTime(new Date());
        goods.setRecommendDesc(recommendDesc);
        goods.setUser(new UserInfo(uid));
        recommendUserGoodsMapper.insertSelective(goods);
        for (CommonGoods commonGoods : goodsList)
            try {
                commonGoods = commonGoodsService.addCommonGoods(commonGoods);
                recommendUserGoodsMapMapper.insertSelective(new RecommendUserGoodsMap(commonGoods, goods, new Date()));
            } catch (CommonGoodsException e) {
                throw new RecommendUserGoodsException(2, "商品添加出错");
            }
    }
    @Override
    public List<RecommendUserGoods> listRecommend(Long uid, int page, int pageSize) {
        return recommendUserGoodsMapper.listRecommendGoods(uid, (page - 1) * pageSize, pageSize);
    }
    @Override
    public long countRecommend(Long uid) {
        return recommendUserGoodsMapper.countRecommendGoods(uid);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoServiceImpl.java
@@ -996,131 +996,6 @@
            System.out.println("订单:" + order);
    }
    @Transactional
    @Override
    public void addHongBao(Order order, TaoBaoOrder taoBaoOrder, Long orderItemId) {
        OrderItem orderItem = orderItemMapper.selectByPrimaryKey(orderItemId);
        // 订单返利比例
        BigDecimal proportion = hongBaoManageService.getFanLiRate();
        BigDecimal baseRate = proportion.divide(new BigDecimal(100));
        // 创建红包
        JSONObject data = new JSONObject();
        HongBao hongBao = null;
        if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算"))
            // 订单结算应该取结算金额与预估收入
            hongBao = HongBaoFactory.createHongBao(MoneyBigDecimalUtil.mul(baseRate, taoBaoOrder.geteIncome()),
                    data.toString(), order.getId(), null, order.getUserInfo(), 1, taoBaoOrder.getSettlement(),
                    taoBaoOrder.getAuctionId());
        else
            hongBao = HongBaoFactory.createHongBao(MoneyBigDecimalUtil.mul(baseRate, taoBaoOrder.getEstimate()),
                    data.toString(), order.getId(), null, order.getUserInfo(), 1, taoBaoOrder.getPayment(),
                    taoBaoOrder.getAuctionId());
        hongBao.setOrderId(taoBaoOrder.getOrderId());
        hongBao.setOrderItemId(orderItem.getId());
        hongBao.setPreGettime(0L);
        if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算")
                && !StringUtil.isNullOrEmpty(taoBaoOrder.getSettlementTime()))
            hongBao.setBalanceTime(
                    new Date(TimeUtil.convertToTimeTemp(taoBaoOrder.getSettlementTime(), "yyyy-MM-dd HH:mm:ss")));
        UserInfo boss = threeSaleMapper.selectBoss(order.getUserInfo().getId());
        if (boss != null) {
            hongBao.setHasChild(true);
        }
        // 如果失效就判定已经失效
        if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单失效"))
            hongBao.setState(HongBao.STATE_SHIXIAO);
        hongBaoMapper.insertSelective(hongBao);
        // 通知用户订单被统计
        if (!taoBaoOrder.getOrderState().equalsIgnoreCase("订单失效")) {
            try {
                userNotificationService.orderFanliStatisticed(hongBao.getUserInfo().getId(), order.getOrderId());
            } catch (Exception e) {
            }
        }
        // 提成订单不处理失效订单
        if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单失效"))
            return;
        if (boss != null) {
            // 计算上级返利金额
            HongBaoManage hbm = hongBaoManageMapper
                    .selectByKey("sale_6_" + (boss.getRank() == null ? 0 : boss.getRank()));
            BigDecimal rate = null;
            if (hbm == null)
                rate = new BigDecimal(0);
            else
                rate = new BigDecimal(hbm.getValue()).divide(new BigDecimal(100));
            if (rate.compareTo(new BigDecimal(0)) > 0) {
                HongBao hongBao2 = null;
                if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算")) {
                    // 订单结算应该取结算金额与预估收入
                    hongBao2 = HongBaoFactory.createHongBao(
                            MoneyBigDecimalUtil.mul(rate, MoneyBigDecimalUtil.mul(taoBaoOrder.geteIncome(), baseRate)),
                            null, hongBao, boss, Constant.ONESALE);
                } else {
                    hongBao2 = HongBaoFactory.createHongBao(
                            MoneyBigDecimalUtil.mul(rate, MoneyBigDecimalUtil.mul(taoBaoOrder.getEstimate(), baseRate)),
                            null, hongBao, boss, Constant.ONESALE);
                }
                HongBaoFactory.createHongBao(
                        MoneyBigDecimalUtil.mul(rate, MoneyBigDecimalUtil.mul(taoBaoOrder.getEstimate(), baseRate)),
                        null, hongBao, boss, Constant.ONESALE);
                // 设置订单号
                hongBao2.setOrderId(taoBaoOrder.getOrderId());
                hongBaoMapper.insertSelective(hongBao2);
                try {
                    // 通知提成订单被统计
                    userNotificationService.tiChengStatisticed(hongBao2.getUserInfo().getId(), hongBao2.getOrderId(),
                            hongBao2.getMoney());
                } catch (Exception e) {
                }
            }
            UserInfo boss2 = threeSaleMapper.selectBoss(boss.getId());
            // 计算上上级返利
            if (boss2 != null) {
                hbm = hongBaoManageMapper.selectByKey("sale_7_" + (boss.getRank() == null ? 0 : boss.getRank()));
                if (hbm == null)
                    rate = new BigDecimal(0);
                else
                    rate = new BigDecimal(hbm.getValue()).divide(new BigDecimal(100));
                if (rate.compareTo(new BigDecimal(0)) > 0) {
                    // 订单结算应该取结算金额与预估收入
                    HongBao hongBao3 = null;
                    if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算"))
                        hongBao3 = HongBaoFactory.createHongBao(
                                MoneyBigDecimalUtil.mul(rate,
                                        MoneyBigDecimalUtil.mul(taoBaoOrder.geteIncome(), baseRate)),
                                null, hongBao, boss2, Constant.TWOSALE);
                    else
                        hongBao3 = HongBaoFactory.createHongBao(
                                MoneyBigDecimalUtil.mul(rate,
                                        MoneyBigDecimalUtil.mul(taoBaoOrder.getEstimate(), baseRate)),
                                null, hongBao, boss2, Constant.TWOSALE);
                    // 设置返利订单号
                    hongBao3.setOrderId(taoBaoOrder.getOrderId());
                    hongBaoMapper.insertSelective(hongBao3);
                    try {
                        // 通知提成订单被统计
                        userNotificationService.tiChengStatisticed(hongBao3.getUserInfo().getId(),
                                hongBao3.getOrderId(), hongBao3.getMoney());
                    } catch (Exception e) {
                    }
                }
            }
        }
    }
    @Override
    public BigDecimal getTotalTiChengMoney(Long uid) {
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoV2ServiceImpl.java
@@ -6,9 +6,11 @@
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.annotation.Resource;
@@ -26,6 +28,7 @@
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper;
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
import com.yeshi.fanli.dto.HongBaoDTO;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
import com.yeshi.fanli.entity.bus.user.HongBao;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.UserInfo;
@@ -41,6 +44,7 @@
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.msg.UserOrderMsgNotificationService;
import com.yeshi.fanli.service.inter.order.CommonOrderService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserNotificationService;
@@ -91,6 +95,18 @@
    @Resource
    private PidOrderMapper pidOrderMapper;
    @Resource
    private HongBaoManageService hongBaoManageService;
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    @Resource
    private UserNotificationService userNotificationService;
    @Resource
    private UserOrderMsgNotificationService userOrderMsgNotificationService;
    @Override
    public int insert(HongBaoV2 record) {
@@ -346,61 +362,122 @@
    }
    @Resource
    private HongBaoManageService hongBaoManageService;
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    @Resource
    private UserNotificationService userNotificationService;
    @Transactional
    @Override
    public void addHongBao(List<CommonOrder> commonOrderList, int type) throws HongBaoException {
        Set<Integer> stateSet = new HashSet<>();// 订单状态Set
        if (commonOrderList != null && commonOrderList.size() > 0) {
            Map<Integer, HongBaoV2> notificationMap = new HashMap<>();
            Map<Integer, HongBaoOrder> notificationMap = new HashMap<>();
            int goodsCount = 0;
            boolean hasAdd = false;
            for (CommonOrder commonOrder : commonOrderList) {
                stateSet.add(commonOrder.getState());
                goodsCount += commonOrder.getCount();
                if (commonOrder == null || commonOrder.getId() == null || commonOrder.getUserInfo() == null)
                    throw new HongBaoException(1, "订单信息不完整");
                HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId());
                if (hongBaoOrder == null) {
                    saveHongBao(commonOrder, type, notificationMap);
                    hasAdd = true;
                } else {
                    updateHongBao(hongBaoOrder, commonOrder, type);
                    updateHongBao(hongBaoOrder, commonOrder, type, notificationMap);
                }
            }
            /**
             * 通知用户的返利情况
             */
            Iterator<Integer> its = notificationMap.keySet().iterator();
            while (its.hasNext()) {
                Integer t = its.next();
                HongBaoV2 notify = notificationMap.get(t);
                String orderId = commonOrderList.get(0).getOrderNo();
                Long uid = notify.getUserInfo().getId();
                BigDecimal money = notify.getMoney();
                switch (t) {
                case HongBaoV2.TYPE_ZIGOU:
                    userNotificationService.orderFanliStatisticed(uid, orderId);
                    break;
                case HongBaoV2.TYPE_SHARE_GOODS:
                    userNotificationService.orderShareStatisticed(uid, orderId, money);
                    break;
                case HongBaoV2.TYPE_YIJI:
                    userNotificationService.orderInviteStatisticed(uid, orderId, money);
                    break;
                case HongBaoV2.TYPE_ERJI:
                    userNotificationService.orderInviteStatisticed(uid, orderId, money);
                    break;
            int state = getOrderState(stateSet);
            if (hasAdd) {
                Iterator<Integer> its = notificationMap.keySet().iterator();
                while (its.hasNext()) {
                    Integer t = its.next();
                    HongBaoV2 notify = notificationMap.get(t).getHongBaoV2();
                    CommonOrder commonOrder = notificationMap.get(t).getCommonOrder();
                    String orderId = commonOrderList.get(0).getOrderNo();
                    Long uid = notify.getUserInfo().getId();
                    BigDecimal money = notify.getMoney();
                    switch (t) {
                    case HongBaoV2.TYPE_ZIGOU:
                        userNotificationService.orderFanliStatisticed(uid, orderId, goodsCount, MsgOrderDetail.STATE_FK,
                                null, money);
                        userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, commonOrder.getPayment(),
                                money, goodsCount, state);
                        break;
                    case HongBaoV2.TYPE_SHARE_GOODS:
                        userNotificationService.orderShareStatisticed(uid, orderId, goodsCount, MsgOrderDetail.STATE_FK,
                                null, money);
                        userOrderMsgNotificationService.orderShareStatistic(uid, orderId, commonOrder.getPayment(),
                                money, goodsCount, state);
                        break;
                    case HongBaoV2.TYPE_YIJI:
                        userNotificationService.orderInviteStatisticed(uid, orderId, goodsCount,
                                MsgOrderDetail.STATE_FK, null, money);
                        userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, commonOrder.getPayment(),
                                money, goodsCount, state);
                        break;
                    case HongBaoV2.TYPE_ERJI:
                        userNotificationService.orderInviteStatisticed(uid, orderId, goodsCount,
                                MsgOrderDetail.STATE_FK, null, money);
                        userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, commonOrder.getPayment(),
                                money, goodsCount, state);
                        break;
                    }
                }
            }
            // 添加新版本通知
            if (!hasAdd) {
                Iterator<Integer> its = notificationMap.keySet().iterator();
                while (its.hasNext()) {
                    Integer t = its.next();
                    HongBaoV2 notify = notificationMap.get(t).getHongBaoV2();
                    CommonOrder commonOrder = notificationMap.get(t).getCommonOrder();
                    String orderId = commonOrderList.get(0).getOrderNo();
                    Long uid = notify.getUserInfo().getId();
                    BigDecimal money = notify.getMoney();
                    switch (t) {
                    case HongBaoV2.TYPE_ZIGOU:
                        userOrderMsgNotificationService.orderFanLiStateChanged(uid, orderId, commonOrder.getPayment(),
                                money, state);
                        break;
                    case HongBaoV2.TYPE_SHARE_GOODS:
                        userOrderMsgNotificationService.orderShareStateChanged(uid, orderId, commonOrder.getPayment(),
                                money, state);
                        break;
                    case HongBaoV2.TYPE_YIJI:
                        userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, commonOrder.getPayment(),
                                money, state);
                        break;
                    case HongBaoV2.TYPE_ERJI:
                        userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, commonOrder.getPayment(),
                                money, state);
                        break;
                    }
                }
            }
        }
    }
    private int getOrderState(Set<Integer> states) {
        if (states.size() == 1)
            return states.iterator().next();
        Iterator<Integer> its = states.iterator();
        while (its.hasNext()) {
            int tempState = its.next();
            if (tempState == CommonOrder.STATE_FK)
                return CommonOrder.STATE_FK;
            else if (tempState == CommonOrder.STATE_JS)
                return CommonOrder.STATE_JS;
        }
        return CommonOrder.STATE_SX;
    }
    @Transactional
    private void updateHongBao(HongBaoOrder hongBaoOrder, CommonOrder commonOrder, int type) throws HongBaoException {
    private void updateHongBao(HongBaoOrder hongBaoOrder, CommonOrder commonOrder, int type,
            Map<Integer, HongBaoOrder> notificationMap) throws HongBaoException {
        System.out.println(commonOrder.getOrderNo());
        HongBaoV2 oldHongBao = hongBaoV2Mapper.selectByPrimaryKey(hongBaoOrder.getHongBaoV2().getId());
        if (oldHongBao == null)
@@ -428,6 +505,24 @@
                hongBao.setMoney(new BigDecimal(0));
            }
            hongBaoV2Mapper.updateByPrimaryKeySelective(hongBao);
            // 加入通知
            if (notificationMap.get(type) == null) {
                HongBaoV2 tempHongBao = new HongBaoV2(hongBao.getId());
                tempHongBao.setUserInfo(hongBao.getUserInfo());
                tempHongBao.setMoney(hongBao.getMoney());
                CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                tempCommonOrder.setPayment(commonOrder.getPayment());
                notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
            } else {
                // 增加付款金额与资金
                HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
                tempHongBaoOrder.getCommonOrder()
                        .setPayment(tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                tempHongBaoOrder.getHongBaoV2()
                        .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(hongBao.getMoney()));
                notificationMap.put(type, tempHongBaoOrder);
            }
            // 获取子红包
            List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId());
@@ -460,6 +555,25 @@
                                MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100))));
                    }
                    hongBaoV2Mapper.updateByPrimaryKeySelective(childUpdate);
                    // 加入通知
                    if (notificationMap.get(type) == null) {
                        HongBaoV2 tempHongBao = new HongBaoV2(child.getId());
                        tempHongBao.setUserInfo(child.getUserInfo());
                        tempHongBao.setMoney(child.getMoney());
                        CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                        tempCommonOrder.setPayment(commonOrder.getPayment());
                        notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
                    } else {
                        // 增加付款金额与资金
                        HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
                        tempHongBaoOrder.getCommonOrder().setPayment(
                                tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                        tempHongBaoOrder.getHongBaoV2()
                                .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(child.getMoney()));
                        notificationMap.put(type, tempHongBaoOrder);
                    }
                }
        } else if (type == HongBaoV2.TYPE_SHARE_GOODS) {
@@ -485,6 +599,23 @@
                hongBao.setMoney(new BigDecimal(0));
            }
            hongBaoV2Mapper.updateByPrimaryKeySelective(hongBao);
            // 通知
            if (notificationMap.get(type) == null) {
                HongBaoV2 tempHongBao = new HongBaoV2(hongBao.getId());
                tempHongBao.setUserInfo(hongBao.getUserInfo());
                tempHongBao.setMoney(hongBao.getMoney());
                CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                tempCommonOrder.setPayment(commonOrder.getPayment());
                notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
            } else {
                // 增加付款金额与资金
                HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
                tempHongBaoOrder.getCommonOrder()
                        .setPayment(tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                tempHongBaoOrder.getHongBaoV2()
                        .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(hongBao.getMoney()));
                notificationMap.put(type, tempHongBaoOrder);
            }
            // 获取子红包
            List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId());
@@ -527,7 +658,7 @@
    }
    @Transactional
    private void saveHongBao(CommonOrder commonOrder, int type, Map<Integer, HongBaoV2> notificationMap)
    private void saveHongBao(CommonOrder commonOrder, int type, Map<Integer, HongBaoOrder> notificationMap)
            throws HongBaoException {
        if (type == HongBaoV2.TYPE_ZIGOU) {// 获取自购的返利比例
            BigDecimal fanliRate = hongBaoManageService.getFanLiRate(commonOrder.getCreateTime().getTime());
@@ -561,10 +692,21 @@
            hongBaoOrder.setHongBaoV2(hongBao);
            hongBaoOrderMapper.insertSelective(hongBaoOrder);
            // 加入通知
            if (notificationMap.get(type) == null)
                notificationMap.put(type, hongBao);
            else {
                notificationMap.get(type).setMoney(notificationMap.get(type).getMoney().add(hongBao.getMoney()));
            if (notificationMap.get(type) == null) {
                HongBaoV2 tempHongBao = new HongBaoV2(hongBao.getId());
                tempHongBao.setUserInfo(hongBao.getUserInfo());
                tempHongBao.setMoney(hongBao.getMoney());
                CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                tempCommonOrder.setPayment(commonOrder.getPayment());
                notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
            } else {
                // 增加付款金额与资金
                HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
                tempHongBaoOrder.getCommonOrder()
                        .setPayment(tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                tempHongBaoOrder.getHongBaoV2()
                        .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(hongBao.getMoney()));
                notificationMap.put(type, tempHongBaoOrder);
            }
            UserInfo boss = threeSaleSerivce.getBoss(user.getId());
@@ -599,11 +741,21 @@
                }
                hongBaoV2Mapper.insertSelective(firstHongbao);
                // 用户通知
                if (notificationMap.get(HongBaoV2.TYPE_YIJI) == null)
                    notificationMap.put(HongBaoV2.TYPE_YIJI, firstHongbao);
                else {
                    notificationMap.get(HongBaoV2.TYPE_YIJI)
                            .setMoney(notificationMap.get(HongBaoV2.TYPE_YIJI).getMoney().add(firstHongbao.getMoney()));
                if (notificationMap.get(type) == null) {
                    HongBaoV2 tempHongBao = new HongBaoV2(firstHongbao.getId());
                    tempHongBao.setUserInfo(firstHongbao.getUserInfo());
                    tempHongBao.setMoney(firstHongbao.getMoney());
                    CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                    tempCommonOrder.setPayment(commonOrder.getPayment());
                    notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
                } else {
                    // 增加付款金额与资金
                    HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
                    tempHongBaoOrder.getCommonOrder()
                            .setPayment(tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                    tempHongBaoOrder.getHongBaoV2()
                            .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(firstHongbao.getMoney()));
                    notificationMap.put(type, tempHongBaoOrder);
                }
                // 插入二级子红包
@@ -637,11 +789,21 @@
                    hongBaoV2Mapper.insertSelective(secondHongbao);
                    // 用户通知
                    if (notificationMap.get(HongBaoV2.TYPE_ERJI) == null)
                        notificationMap.put(HongBaoV2.TYPE_ERJI, secondHongbao);
                    else {
                        notificationMap.get(HongBaoV2.TYPE_ERJI).setMoney(
                                notificationMap.get(HongBaoV2.TYPE_ERJI).getMoney().add(secondHongbao.getMoney()));
                    if (notificationMap.get(type) == null) {
                        HongBaoV2 tempHongBao = new HongBaoV2(secondHongbao.getId());
                        tempHongBao.setUserInfo(secondHongbao.getUserInfo());
                        tempHongBao.setMoney(secondHongbao.getMoney());
                        CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                        tempCommonOrder.setPayment(commonOrder.getPayment());
                        notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
                    } else {
                        // 增加付款金额与资金
                        HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
                        tempHongBaoOrder.getCommonOrder().setPayment(
                                tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                        tempHongBaoOrder.getHongBaoV2()
                                .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(secondHongbao.getMoney()));
                        notificationMap.put(type, tempHongBaoOrder);
                    }
                }
@@ -682,10 +844,21 @@
            hongBaoOrder.setHongBaoV2(hongBao);
            hongBaoOrderMapper.insertSelective(hongBaoOrder);
            if (notificationMap.get(type) == null)
                notificationMap.put(type, hongBao);
            else {
                notificationMap.get(type).setMoney(notificationMap.get(type).getMoney().add(hongBao.getMoney()));
            if (notificationMap.get(type) == null) {
                HongBaoV2 tempHongBao = new HongBaoV2(hongBao.getId());
                tempHongBao.setUserInfo(hongBao.getUserInfo());
                tempHongBao.setMoney(hongBao.getMoney());
                CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
                tempCommonOrder.setPayment(commonOrder.getPayment());
                notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
            } else {
                // 增加付款金额与资金
                HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
                tempHongBaoOrder.getCommonOrder()
                        .setPayment(tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
                tempHongBaoOrder.getHongBaoV2()
                        .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(hongBao.getMoney()));
                notificationMap.put(type, tempHongBaoOrder);
            }
            // 修改统计数据
fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/ThreeSaleSerivceImpl.java
@@ -32,6 +32,7 @@
import com.yeshi.fanli.service.inter.config.InviteGetMoneyService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.msg.UserInviteMsgNotificationService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
@@ -56,6 +57,9 @@
    @Resource
    private ThreeSaleMapper threeSaleMapper;
    @Resource
    private UserInviteMsgNotificationService userInviteMsgNotificationService;
    public UserInfo getBoss(final long uid) {
        return (UserInfo) dao.excute(new HibernateCallback<UserInfo>() {
@@ -108,6 +112,11 @@
            threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
            threeSale.setWorker(inviteeUser);
            threeSaleMapper.insertSelective(threeSale);
            //创建通知
            userInviteMsgNotificationService.inviteScan(inviter.getId(), threeSale);
        } else {// 是已经存在的用户
            // 用户已经存在我们的用户库中
@@ -133,7 +142,7 @@
                        threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
                        threeSale.setWorker(invitee);
                        threeSaleMapper.insertSelective(threeSale);
                        userInviteMsgNotificationService.inviteScan(inviter.getId(), threeSale);
                        // threeSaleSerivce.bind(invitee, inviter);
                    } else {
@@ -160,6 +169,8 @@
            dao.update(threeSale);
            if (inviter != null)
                reComputeUserRank(inviter.getId());
            //通知
            userInviteMsgNotificationService.inviteSuccess(inviter.getId(), threeSale);
            // }
            // });
        }
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgAccountDetailServiceImpl.java
New file
@@ -0,0 +1,52 @@
package com.yeshi.fanli.service.impl.msg;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.msg.MsgAccountDetailMapper;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
import com.yeshi.fanli.exception.msg.MsgAccountDetailException;
import com.yeshi.fanli.service.inter.msg.MsgAccountDetailService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
@Service
public class MsgAccountDetailServiceImpl implements MsgAccountDetailService {
    @Resource
    private MsgAccountDetailMapper msgAccountDetailMapper;
    @Override
    public void addMsgAccountDetail(MsgAccountDetail detail) throws MsgAccountDetailException {
        if (detail == null)
            throw new MsgAccountDetailException(1, "消息为空");
        if (StringUtil.isNullOrEmpty(detail.getTitle()) || StringUtil.isNullOrEmpty(detail.getContent())
                || detail.getType() == null || detail.getUser() == null)
            throw new MsgAccountDetailException(2, "消息内容不完整");
        // 持久化到数据库
        detail.setCreateTime(new Date());
        detail.setUpdateTime(new Date());
        detail.setRead(false);
        msgAccountDetailMapper.insertSelective(detail);
    }
    @Override
    public List<MsgAccountDetail> listMsgAccountDetail(Long uid, int page) {
        return msgAccountDetailMapper.listByUid(uid, (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE);
    }
    @Override
    public long countMsgAccountDetail(Long uid) {
        return msgAccountDetailMapper.countByUid(uid);
    }
    @Override
    public void readMsgByUid(Long uid) {
        msgAccountDetailMapper.setMsgReadByUid(uid);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgInviteDetailServiceImpl.java
New file
@@ -0,0 +1,72 @@
package com.yeshi.fanli.service.impl.msg;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.msg.MsgInviteDetailMapper;
import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.exception.msg.MsgInviteDetailException;
import com.yeshi.fanli.service.inter.msg.MsgInviteDetailService;
import com.yeshi.fanli.util.Constant;
@Service
public class MsgInviteDetailServiceImpl implements MsgInviteDetailService {
    @Resource
    private MsgInviteDetailMapper msgInviteDetailMapper;
    @Override
    public void addMsgInviteDetail(MsgInviteDetail detail) throws MsgInviteDetailException {
        if (detail == null)
            throw new MsgInviteDetailException(1, "消息为空");
        if (detail.getInviteUser() == null || detail.getMsgType() == null || detail.getUser() == null
                || detail.getDesc() == null)
            throw new MsgInviteDetailException(2, "消息内容不完整");
        // 查询是否已存在该邀请ID
        MsgInviteDetail oldDetail = msgInviteDetailMapper.selectByThreeSaleId(detail.getInviteUser().getId());
        if (oldDetail == null) {
            detail.setCreateTime(new Date());
            detail.setUpdateTime(new Date());
            detail.setRead(false);
            msgInviteDetailMapper.insertSelective(detail);
        } else {
            MsgInviteDetail update = new MsgInviteDetail();
            update.setId(oldDetail.getId());
            if (!detail.getInviteUser().getState()) {
                if (detail.getInviteUser().getExpire() == ThreeSale.EXPIRE_NORMAL) {
                    update.setDesc("恭喜你,有新队员加入你的队列,若对方60天内未激活将会与你脱离邀请关系");
                } else {
                    update.setDesc("抱歉,该队员因60天内未激活,已脱离了你的队列,可以试着重新邀请");
                }
            } else {
                update.setDesc("恭喜你,成功邀请一个队员");
            }
            update.setUpdateTime(new Date());
            update.setRead(false);
            msgInviteDetailMapper.updateByPrimaryKeySelective(update);
        }
    }
    @Override
    public List<MsgInviteDetail> listMsgInviteDetail(Long uid, int page) {
        return msgInviteDetailMapper.listByUid(uid, (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE);
    }
    @Override
    public long countMsgInviteDetail(Long uid) {
        return msgInviteDetailMapper.countByUid(uid);
    }
    @Override
    public void readMsgByUid(Long uid) {
        msgInviteDetailMapper.setMsgReadByUid(uid);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgMoneyDetailServiceImpl.java
New file
@@ -0,0 +1,101 @@
package com.yeshi.fanli.service.impl.msg;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.msg.MsgMoneyDetailMapper;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
import com.yeshi.fanli.exception.msg.MsgMoneyDetailException;
import com.yeshi.fanli.service.inter.msg.MsgMoneyDetailService;
import com.yeshi.fanli.util.Constant;
@Service
public class MsgMoneyDetailServiceImpl implements MsgMoneyDetailService {
    @Resource
    private MsgMoneyDetailMapper msgMoneyDetailMapper;
    @Override
    public void addMsgMoneyDetail(MsgMoneyDetail detail) throws MsgMoneyDetailException {
        if (detail == null)
            throw new MsgMoneyDetailException(1, "消息为空");
        if (detail.getMsgType() == MsgTypeMoneyTypeEnum.extract) {
            if (detail.getExtract() == null || detail.getUser() == null)
                throw new MsgMoneyDetailException(2, "消息信息不全");
            MsgMoneyDetail msg = msgMoneyDetailMapper.selectBySourceIdAndMsgType(detail.getExtract().getId(),
                    MsgTypeMoneyTypeEnum.extract);
            if (msg == null) {
                detail.setCreateTime(new Date());
                detail.setUpdateTime(new Date());
                detail.setRead(false);
                msgMoneyDetailMapper.insertSelective(detail);
            } else {
                MsgMoneyDetail update = new MsgMoneyDetail();
                update.setId(msg.getId());
                update.setUpdateTime(new Date());
                update.setRead(false);
                update.setStateDesc(detail.getStateDesc());
                msgMoneyDetailMapper.updateByPrimaryKeySelective(update);
            }
        } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.extractValid) {
            if (detail.getAlipayAccountValid() == null || detail.getUser() == null)
                throw new MsgMoneyDetailException(2, "消息信息不全");
            MsgMoneyDetail msg = msgMoneyDetailMapper.selectBySourceIdAndMsgType(detail.getAlipayAccountValid().getId(),
                    MsgTypeMoneyTypeEnum.extractValid);
            if (msg == null) {
                detail.setCreateTime(new Date());
                detail.setUpdateTime(new Date());
                detail.setRead(false);
                msgMoneyDetailMapper.insertSelective(detail);
            } else {
                MsgMoneyDetail update = new MsgMoneyDetail();
                update.setId(msg.getId());
                update.setUpdateTime(new Date());
                update.setRead(false);
                update.setStateDesc(detail.getStateDesc());
                msgMoneyDetailMapper.updateByPrimaryKeySelective(update);
            }
        } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.fanli) {
            if (detail.getMoney() == null || detail.getGoodsCount() == null || detail.getOrderId() == null
                    || detail.getBalance() == null)
                throw new MsgMoneyDetailException(2, "消息信息不全");
            detail.setCreateTime(new Date());
            detail.setUpdateTime(new Date());
            detail.setRead(false);
            msgMoneyDetailMapper.insertSelective(detail);
        } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.invite
                || detail.getMsgType() == MsgTypeMoneyTypeEnum.share) {
            if (detail.getMoney() == null || detail.getGoodsCount() == null || detail.getOrderCount() == null
                    || detail.getBalance() == null)
                throw new MsgMoneyDetailException(2, "消息信息不全");
            detail.setCreateTime(new Date());
            detail.setUpdateTime(new Date());
            detail.setRead(false);
            msgMoneyDetailMapper.insertSelective(detail);
        }
    }
    @Override
    public List<MsgMoneyDetail> listMsgMoneyDetail(Long uid, int page) {
        return msgMoneyDetailMapper.listByUid(uid, (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE);
    }
    @Override
    public long countMsgMoneyDetail(Long uid) {
        return msgMoneyDetailMapper.countByUid(uid);
    }
    @Override
    public void readMsgByUid(Long uid) {
        msgMoneyDetailMapper.setMsgReadByUid(uid);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgOrderDetailServiceImpl.java
New file
@@ -0,0 +1,94 @@
package com.yeshi.fanli.service.impl.msg;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.msg.MsgOrderDetailMapper;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.exception.msg.MsgOrderDetailException;
import com.yeshi.fanli.service.inter.msg.MsgOrderDetailService;
import com.yeshi.fanli.util.Constant;
@Service
public class MsgOrderDetailServiceImpl implements MsgOrderDetailService {
    @Resource
    private MsgOrderDetailMapper msgOrderDetailMapper;
    @Override
    public void addMsgOrderDetail(MsgOrderDetail detail) throws MsgOrderDetailException {
        if (detail == null)
            throw new MsgOrderDetailException(1, "消息为空");
        if (detail.getOrderId() == null || detail.getGoodsCount() == null || detail.getType() == null
                || detail.getState() == null || detail.getPayMoney() == null || detail.getUser() == null)
            throw new MsgOrderDetailException(2, "消息不完整");
        MsgOrderDetail old = msgOrderDetailMapper.selectByUidAndOrderId(detail.getUser().getId(), detail.getOrderId());
        if (old == null) {
            detail.setCreateTime(new Date());
            detail.setUpdateTime(new Date());
            detail.setRead(false);
            msgOrderDetailMapper.insertSelective(detail);
        } else {
            MsgOrderDetail update = new MsgOrderDetail();
            update.setId(old.getId());
            update.setUpdateTime(new Date());
            update.setState(detail.getState());
            update.setPayMoney(detail.getPayMoney());
            update.setHongBaoMoney(detail.getHongBaoMoney());
            update.setRead(false);
            update.setBeiZhu(detail.getBeiZhu());
            msgOrderDetailMapper.updateByPrimaryKeySelective(update);
        }
    }
    @Override
    public List<MsgOrderDetail> listMsgOrderDetail(Long uid, int page) {
        return msgOrderDetailMapper.listByUid(uid, (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE);
    }
    @Override
    public long countMsgOrderDetail(Long uid) {
        return msgOrderDetailMapper.countByUid(uid);
    }
    @Override
    public void readMsgByUid(Long uid) {
        msgOrderDetailMapper.setMsgReadByUid(uid);
    }
    @Override
    public void updateMsgOrderDetail(MsgOrderDetail detail) throws MsgOrderDetailException {
        if (detail == null)
            throw new MsgOrderDetailException(1, "消息为空");
        if (detail.getOrderId() == null || detail.getState() == null || detail.getUser() == null)
            throw new MsgOrderDetailException(2, "消息不完整");
        MsgOrderDetail msg = msgOrderDetailMapper.selectByUidAndOrderId(detail.getUser().getId(), detail.getOrderId());
        if (msg == null)
            return;
        if (msg.getState() == CommonOrder.STATE_WQ)
            return;
        MsgOrderDetail update = new MsgOrderDetail();
        update.setId(detail.getId());
        update.setHongBaoMoney(detail.getHongBaoMoney());
        update.setPayMoney(detail.getPayMoney());
        if (detail.getState().intValue() != msg.getState()) {
            update.setState(detail.getState());
            update.setUpdateTime(new Date());
        }
        msgOrderDetailMapper.updateByPrimaryKeySelective(update);
    }
    @Override
    public List<MsgOrderDetail> listMsgOrderByOrderId(String orderId) {
        return msgOrderDetailMapper.listByOrderId(orderId);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserAccountMsgNotificationServiceImpl.java
New file
@@ -0,0 +1,69 @@
package com.yeshi.fanli.service.impl.msg;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
import com.yeshi.fanli.exception.msg.MsgAccountDetailException;
import com.yeshi.fanli.service.inter.msg.MsgAccountDetailService;
import com.yeshi.fanli.service.inter.msg.UserAccountMsgNotificationService;
import com.yeshi.fanli.util.factory.msg.MsgAccountDetailFactory;
@Service
public class UserAccountMsgNotificationServiceImpl implements UserAccountMsgNotificationService {
    @Resource
    private MsgAccountDetailService msgAccountDetailService;
    @Override
    public void bindingSuccess(Long uid, int type) {
        MsgAccountDetail detail = MsgAccountDetailFactory.createBindingAccount(uid, type);
        try {
            msgAccountDetailService.addMsgAccountDetail(detail);
        } catch (MsgAccountDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void unBindingSuccess(Long uid, int type) {
        MsgAccountDetail detail = MsgAccountDetailFactory.createUnBindingAccount(uid, type);
        try {
            msgAccountDetailService.addMsgAccountDetail(detail);
        } catch (MsgAccountDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void changeBindingSuccess(Long uid, int type) {
        MsgAccountDetail detail = MsgAccountDetailFactory.createChangeBindingAccount(uid, type);
        try {
            msgAccountDetailService.addMsgAccountDetail(detail);
        } catch (MsgAccountDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void connectSuccess(Long uid, Long lessUid) {
        MsgAccountDetail detail = MsgAccountDetailFactory.createConnectAccount(uid, lessUid);
        try {
            msgAccountDetailService.addMsgAccountDetail(detail);
        } catch (MsgAccountDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void userRank(Long uid, String orderType, int orderCount, String rankName) {
        MsgAccountDetail detail = MsgAccountDetailFactory.createUserRank(uid, orderType, orderCount, rankName);
        try {
            msgAccountDetailService.addMsgAccountDetail(detail);
        } catch (MsgAccountDetailException e) {
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserInviteMsgNotificationServiceImpl.java
New file
@@ -0,0 +1,29 @@
package com.yeshi.fanli.service.impl.msg;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.service.inter.msg.UserInviteMsgNotificationService;
@Service
public class UserInviteMsgNotificationServiceImpl  implements UserInviteMsgNotificationService{
    @Override
    public void inviteScan(Long uid, ThreeSale sale) {
        // TODO Auto-generated method stub
    }
    @Override
    public void inviteSuccess(Long uid, ThreeSale sale) {
        // TODO Auto-generated method stub
    }
    @Override
    public void inviteFail(Long uid, ThreeSale sale) {
        // TODO Auto-generated method stub
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserMoneyMsgNotificationServiceImpl.java
New file
@@ -0,0 +1,134 @@
package com.yeshi.fanli.service.impl.msg;
import java.math.BigDecimal;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
import com.yeshi.fanli.entity.bus.user.Extract;
import com.yeshi.fanli.exception.msg.MsgMoneyDetailException;
import com.yeshi.fanli.service.inter.msg.MsgMoneyDetailService;
import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
import com.yeshi.fanli.util.factory.msg.MsgMoneyDetailFactory;
@Service
public class UserMoneyMsgNotificationServiceImpl implements UserMoneyMsgNotificationService {
    @Resource
    private MsgMoneyDetailService msgMoneyDetailService;
    @Override
    public void extractApplay(Extract extract) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createExtractApplyMsg(extract, extract.getUserInfo().getId(),
                null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void extractFail(Extract extract, String stateDesc) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createExtractFailMsg(extract, extract.getUserInfo().getId(),
                stateDesc);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void extractSuccess(Extract extract) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createExtractSuccessMsg(extract, extract.getUserInfo().getId(),
                null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void alipayAccountValid(AlipayAccountValidNormalHistory history) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createAlipayAccountValidMsg(history, history.getUid(),
                "重庆椰视网络有限公司", new BigDecimal("0.1"), null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void fanliOrderReceived(Long uid, String orderId, int goodsCount, BigDecimal money, BigDecimal balance) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createFailiMsg(money, balance, orderId, goodsCount, uid, null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void fanliOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createFailiWeiQuanMsg(uid, orderId, money, balance, null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void shareOrderReceived(Long uid, int orderCount, int goodsCount, BigDecimal money, BigDecimal balance) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createShareMsg(money, balance, orderCount, goodsCount, uid, null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void shareOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createShareWeiQuanMsg(uid, orderId, money, balance, null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void inviteOrderReceived(Long uid, int orderCount, int goodsCount, BigDecimal money, BigDecimal balance) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createInviteMsg(money, balance, orderCount, goodsCount, uid,
                null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void inviteOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createInviteWeiQuanMsg(uid, orderId, money, balance, null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserMsgReadStateServiceImpl.java
New file
@@ -0,0 +1,186 @@
package com.yeshi.fanli.service.impl.msg;
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.yeshi.fanli.dao.mybatis.msg.UserMsgUnReadNumMapper;
import com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.service.inter.msg.MsgAccountDetailService;
import com.yeshi.fanli.service.inter.msg.MsgInviteDetailService;
import com.yeshi.fanli.service.inter.msg.MsgMoneyDetailService;
import com.yeshi.fanli.service.inter.msg.MsgOrderDetailService;
import com.yeshi.fanli.service.inter.msg.UserMsgReadStateService;
import com.yeshi.fanli.service.inter.msg.UserSystemMsgService;
@Service
public class UserMsgReadStateServiceImpl implements UserMsgReadStateService {
    @Resource
    private UserMsgUnReadNumMapper userMsgUnReadNumMapper;
    @Resource
    private MsgAccountDetailService msgAccountDetailService;
    @Resource
    private MsgOrderDetailService msgOrderDetailService;
    @Resource
    private MsgInviteDetailService msgInviteDetailService;
    @Resource
    private MsgMoneyDetailService msgMoneyDetailService;
    @Resource
    private UserSystemMsgService userSystemMsgService;
    private UserMsgUnReadNum getUserMsgUnReadNum(Long uid) {
        UserMsgUnReadNum userMsgUnReadNum = userMsgUnReadNumMapper.selectByUid(uid);
        if (userMsgUnReadNum == null) {
            UserMsgUnReadNum um = new UserMsgUnReadNum();
            um.setCreateTime(new Date());
            um.setUser(new UserInfo(uid));
            userMsgUnReadNumMapper.insertSelective(um);
            return userMsgUnReadNumMapper.selectByPrimaryKey(um.getId());
        }
        return userMsgUnReadNum;
    }
    @Override
    public void addOrderMsgUnReadCount(Long uid, int count) {
        UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
        UserMsgUnReadNum update = new UserMsgUnReadNum();
        update.setId(num.getId());
        update.setTypeOrder(num.getTypeOrder() + count);
        update.setUpdateTime(new Date());
        userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
    }
    @Override
    public void addAccountMsgUnReadCount(Long uid, int count) {
        UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
        UserMsgUnReadNum update = new UserMsgUnReadNum();
        update.setId(num.getId());
        update.setTypeAccount(num.getTypeAccount() + count);
        update.setUpdateTime(new Date());
        userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
    }
    @Override
    public void addMoneyMsgUnReadCount(Long uid, int count) {
        UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
        UserMsgUnReadNum update = new UserMsgUnReadNum();
        update.setId(num.getId());
        update.setTypeMoney(num.getTypeMoney() + count);
        update.setUpdateTime(new Date());
        userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
    }
    @Override
    public void addInviteMsgUnReadCount(Long uid, int count) {
        UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
        UserMsgUnReadNum update = new UserMsgUnReadNum();
        update.setId(num.getId());
        update.setTypeInvite(num.getTypeInvite() + count);
        update.setUpdateTime(new Date());
        userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
    }
    @Override
    public void addSystemMsgUnReadCount(Long uid, int count) {
        UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
        UserMsgUnReadNum update = new UserMsgUnReadNum();
        update.setId(num.getId());
        update.setTypeSystem(num.getTypeSystem() + count);
        update.setUpdateTime(new Date());
        userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
    }
    @Override
    public UserMsgUnReadNum getReadStateByUid(Long uid) {
        return getUserMsgUnReadNum(uid);
    }
    @Override
    public void readOrderMsg(Long uid) {
        msgOrderDetailService.readMsgByUid(uid);
        UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
        UserMsgUnReadNum update = new UserMsgUnReadNum();
        update.setId(num.getId());
        update.setTypeOrder(0);
        update.setUpdateTime(new Date());
        userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
    }
    @Override
    public void readAccountMsg(Long uid) {
        msgAccountDetailService.readMsgByUid(uid);
        UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
        UserMsgUnReadNum update = new UserMsgUnReadNum();
        update.setId(num.getId());
        update.setTypeAccount(0);
        update.setUpdateTime(new Date());
        userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
    }
    @Override
    public void readMoneyMsg(Long uid) {
        msgMoneyDetailService.readMsgByUid(uid);
        UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
        UserMsgUnReadNum update = new UserMsgUnReadNum();
        update.setId(num.getId());
        update.setTypeMoney(0);
        update.setUpdateTime(new Date());
        userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
    }
    @Override
    public void readInviteMsg(Long uid) {
        msgInviteDetailService.readMsgByUid(uid);
        UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
        UserMsgUnReadNum update = new UserMsgUnReadNum();
        update.setId(num.getId());
        update.setTypeInvite(0);
        update.setUpdateTime(new Date());
        userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
    }
    @Override
    public void readUserSystemMsg(Long uid) {
        userSystemMsgService.readMsgByUid(uid);
        UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
        UserMsgUnReadNum update = new UserMsgUnReadNum();
        update.setId(num.getId());
        update.setTypeSystem(0);
        update.setUpdateTime(new Date());
        userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
    }
    @Transactional
    @Override
    public void setAllMsgRead(Long uid) {
        UserMsgUnReadNum userMsgNum = getUserMsgUnReadNum(uid);
        UserMsgUnReadNum update = new UserMsgUnReadNum();
        update.setId(userMsgNum.getId());
        update.setTypeAccount(0);
        update.setTypeInvite(0);
        update.setTypeMoney(0);
        update.setTypeOrder(0);
        update.setTypeScore(0);
        update.setTypeSystem(0);
        update.setUpdateTime(new Date());
        userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
        readAccountMsg(uid);
        readOrderMsg(uid);
        readMoneyMsg(uid);
        readInviteMsg(uid);
        readUserSystemMsg(uid);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserOrderMsgNotificationServiceImpl.java
New file
@@ -0,0 +1,98 @@
package com.yeshi.fanli.service.impl.msg;
import java.math.BigDecimal;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
import com.yeshi.fanli.exception.msg.MsgOrderDetailException;
import com.yeshi.fanli.service.inter.msg.MsgOrderDetailService;
import com.yeshi.fanli.service.inter.msg.UserOrderMsgNotificationService;
import com.yeshi.fanli.util.factory.msg.MsgOrderDetailFactory;
@Service
public class UserOrderMsgNotificationServiceImpl implements UserOrderMsgNotificationService {
    @Resource
    private MsgOrderDetailService msgOrderDetailService;
    @Override
    public void orderFanLiStatistic(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int goodsCount,
            int orderState) {
        MsgOrderDetail detail = MsgOrderDetailFactory.createFanLiOrder(uid, orderId, goodsCount, orderState, payMoney,
                money, null);
        try {
            msgOrderDetailService.addMsgOrderDetail(detail);
        } catch (MsgOrderDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void orderFanLiStateChanged(Long uid, String orderId, BigDecimal payMoney, BigDecimal money,
            int orderState) {
        MsgOrderDetail detail = MsgOrderDetailFactory.createFanLiOrder(uid, orderId, 0, orderState, payMoney, money,
                null);
        try {
            msgOrderDetailService.updateMsgOrderDetail(detail);
        } catch (MsgOrderDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void orderShareStatistic(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int goodsCount,
            int orderState) {
        MsgOrderDetail detail = MsgOrderDetailFactory.createShareOrder(uid, orderId, goodsCount, orderState, payMoney,
                money, null);
        try {
            msgOrderDetailService.addMsgOrderDetail(detail);
        } catch (MsgOrderDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void orderShareStateChanged(Long uid, String orderId, BigDecimal payMoney, BigDecimal money,
            int orderState) {
        MsgOrderDetail detail = MsgOrderDetailFactory.createShareOrder(uid, orderId, 0, orderState, payMoney, money,
                null);
        try {
            msgOrderDetailService.updateMsgOrderDetail(detail);
        } catch (MsgOrderDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void orderInviteStatistic(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int goodsCount,
            int orderState) {
        MsgOrderDetail detail = MsgOrderDetailFactory.createInviteOrder(uid, orderId, goodsCount, orderState, payMoney,
                money, null);
        try {
            msgOrderDetailService.addMsgOrderDetail(detail);
        } catch (MsgOrderDetailException e) {
            e.printStackTrace();
        }
    }
    @Override
    public void orderInviteStateChanged(Long uid, String orderId, BigDecimal payMoney, BigDecimal money,
            int orderState) {
        MsgOrderDetail detail = MsgOrderDetailFactory.createInviteOrder(uid, orderId, 0, orderState, payMoney, money,
                null);
        try {
            msgOrderDetailService.updateMsgOrderDetail(detail);
        } catch (MsgOrderDetailException e) {
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserSystemMsgServiceImpl.java
New file
@@ -0,0 +1,102 @@
package com.yeshi.fanli.service.impl.msg;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.msg.UserSystemMsgMapper;
import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
import com.yeshi.fanli.entity.bus.msg.UserSystemMsgTypeEnum;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.system.SystemZnx;
import com.yeshi.fanli.exception.msg.UserSystemMsgException;
import com.yeshi.fanli.service.inter.msg.UserSystemMsgService;
import com.yeshi.fanli.util.StringUtil;
@Service
public class UserSystemMsgServiceImpl implements UserSystemMsgService {
    @Resource
    private UserSystemMsgMapper userSystemMsgMapper;
    @Override
    public void addUserSystemMsg(Long uid, UserSystemMsgTypeEnum type, String title, String content, int timeTag,
            SystemZnx sz) throws UserSystemMsgException {
        if (sz == null && (StringUtil.isNullOrEmpty(title) || StringUtil.isNullOrEmpty(content) || uid == null))
            throw new UserSystemMsgException(1, "信息不完整");
        UserSystemMsg msg = new UserSystemMsg();
        if (sz != null) {
            if (userSystemMsgMapper.selectBySystemZNXId(sz.getId()) == null) {
                msg.setCreateTime(new Date(sz.getCreateTime()));
                msg.setRead(false);
                msg.setSolved(false);
                msg.setSystemZNX(sz);
                msg.setUser(new UserInfo(uid));
                msg.setType(type);
                msg.setTimeTag(timeTag);
            } else
                throw new UserSystemMsgException(1, "消息已存在");
        } else {
            msg.setCreateTime(new Date());
            msg.setRead(false);
            msg.setSolved(false);
            msg.setContent(content);
            msg.setTitle(title);
            msg.setUser(new UserInfo(uid));
            msg.setType(type);
            msg.setTimeTag(timeTag);
        }
        userSystemMsgMapper.insertSelective(msg);
    }
    @Override
    public UserSystemMsg getLatestUserSystemMsg(Long uid) {
        UserSystemMsg msg = userSystemMsgMapper.selectLatestUserSystemMsg(uid);
        if (msg != null)
            if (msg.getSystemZNX() != null) {
                msg.setTitle(msg.getSystemZNX().getTitle());
                msg.setContent(msg.getSystemZNX().getContent());
            }
        return msg;
    }
    @Override
    public List<UserSystemMsg> listUserSystemMsg(Long uid, int page, int pageSize) {
        List<UserSystemMsg> list = userSystemMsgMapper.listByUid(uid, (page - 1) * pageSize, pageSize);
        if (list != null)
            for (UserSystemMsg msg : list) {
                if (msg.getSystemZNX() != null) {
                    msg.setTitle(msg.getSystemZNX().getTitle());
                    msg.setContent(msg.getSystemZNX().getContent());
                }
            }
        return list;
    }
    @Override
    public long countUserSystemMsg(Long uid) {
        return userSystemMsgMapper.countByUid(uid);
    }
    @Override
    public void setSystemMsgSolved(Long uid, Long id) throws UserSystemMsgException {
        UserSystemMsg msg = userSystemMsgMapper.selectByPrimaryKey(id);
        if (msg.getUser().getId() != uid.longValue())
            throw new UserSystemMsgException(2, "不是自己的消息");
        UserSystemMsg update = new UserSystemMsg();
        update.setId(id);
        update.setSolved(true);
        update.setUpdateTime(new Date());
        userSystemMsgMapper.updateByPrimaryKeySelective(update);
    }
    @Override
    public void readMsgByUid(Long uid) {
        userSystemMsgMapper.setMsgReadByUid(uid);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -34,11 +34,8 @@
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
import com.yeshi.fanli.entity.bus.user.AccountDetails;
import com.yeshi.fanli.entity.bus.user.HongBao;
import com.yeshi.fanli.entity.bus.user.HongBaoExtra;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.MoneyRecord;
import com.yeshi.fanli.entity.bus.user.Order;
import com.yeshi.fanli.entity.bus.user.OrderItem;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.money.UserMoneyDetail;
import com.yeshi.fanli.entity.order.CommonOrder;
@@ -48,7 +45,6 @@
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
import com.yeshi.fanli.entity.taobao.TaobaoOrderHongBao;
import com.yeshi.fanli.exception.HongBaoException;
import com.yeshi.fanli.exception.ObjectStateException;
import com.yeshi.fanli.exception.OrderItemException;
@@ -60,6 +56,7 @@
import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
import com.yeshi.fanli.service.inter.order.CommonOrderService;
import com.yeshi.fanli.service.inter.order.LostOrderService;
import com.yeshi.fanli.service.inter.order.OrderItemServcie;
@@ -72,7 +69,6 @@
import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanDrawBackService;
import com.yeshi.fanli.service.inter.user.UserNotificationService;
import com.yeshi.fanli.util.CMQManager;
import com.yeshi.fanli.util.HongBaoUtil;
import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
@@ -162,6 +158,9 @@
    @Resource
    private HongBaoV2Mapper hongBaoV2Mapper;
    @Resource
    private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
    @Override
    public void processOrder(Map<String, List<TaoBaoOrder>> orders) {
@@ -379,216 +378,18 @@
        return validCount >= list.size();
    }
    @Override
    @Transactional
    public void processShopingFanliOrder(String orderId, List<TaoBaoOrder> orderList)
            throws HongBaoException, OrderItemException {
        List<TaoBaoUnionConfig> configList = taoBaoUnionConfigService.getConfigByTypeCache(PidUser.TYPE_FANLI_ANDROID);
        Order oldOrder = orderMapper.selectOrderByOrderId(orderId);
        // 原来不存在订单
        if (oldOrder == null && orderList.size() > 0) {
            // 获取产生订单的PID
            String mediaId = orderList.get(0).getSourceMediaId();
            String adzoneId = orderList.get(0).getAdPositionId();
            String pid = String.format("mm_%s_%s_%s", configList.get(0).getAccountId(), mediaId, adzoneId);
            // 查询该PID是否有对应的用户
            PidUser pidUser = pidUserMapper.selectByPid(pid);
            // 判断是否属于返利的PID
            if (pidUser != null && (pidUser.getType() == PidUser.TYPE_FANLI_ANDROID
                    || pidUser.getType() == PidUser.TYPE_FANLI_IOS)) {
                // 如果是订单失效就不处理
                // 2018-08-02开始生效
                if (isOrderValid(orderList))
                    if (TimeUtil.convertToTimeTemp(orderList.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss") < TimeUtil
                            .convertToTimeTemp("2018-08-02", "yyyy-MM-dd"))
                        return;
                // 添加到订单中去
                Order order = new Order();
                order.setBeizhu("PID返利订单");
                order.setCreatetime(System.currentTimeMillis());
                order.setOrderId(orderId);
                order.setOrderType(1);
                order.setState(Order.STATE_YIZHIFU);
                order.setUserInfo(new UserInfo(pidUser.getUid()));
                order.setVersion(2);
                // 加入到订单表
                orderMapper.insertSelective(order);
                oldOrder = order;
            }
        }
        if (oldOrder != null) {// 该订单号可以返利
            // 原来失效的订单不再处理
            // if (oldOrder.getState() == Order.STATE_SHIXIAO)
            // return;
            // 更新订单的状态
            Order updateOrder = new Order();
            updateOrder.setId(oldOrder.getId());
            updateOrder.setThirdCreateTime(
                    new Date(TimeUtil.convertToTimeTemp(orderList.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
            if (isOrderValid(orderList)) {
                // 处理订单失效
                updateOrder.setState(Order.STATE_SHIXIAO);
                if (oldOrder.getState() == Order.STATE_YIZHIFU)
                    updateOrder.setDrawbackTime(System.currentTimeMillis());
                updateOrder.setThirdState("订单失效");
            } else// 计算订单的总金额
            {
                BigDecimal money = new BigDecimal(0);
                for (TaoBaoOrder o : orderList) {
                    if (o.getOrderState().equalsIgnoreCase("订单结算"))
                        money = money.add(o.getSettlement());
                    else {
                        money = money.add(o.getPayment());
                    }
                }
                updateOrder.setMoney(money);
                String thirdState = null;
                for (TaoBaoOrder o : orderList)
                    if (!o.getOrderState().equalsIgnoreCase("订单失效")) {
                        thirdState = o.getOrderState();
                        break;
                    }
                updateOrder.setThirdState(thirdState);
            }
            orderMapper.updateByPrimaryKeySelective(updateOrder);
            Order order = oldOrder;
            // 订单返利比例
            BigDecimal rate = hongBaoManageService.getFanLiRate();
            // 查找是否存在红包
            List<HongBao> hongBaoList = hongBaoMapper.selectByOid(order.getId());
            // 还没有加入有效的订单
            if ((hongBaoList == null || hongBaoList.size() == 0)) {
                for (TaoBaoOrder taoBaoOrder : orderList) {
                    // 创建OrderItem;
                    OrderItem orderItem = orderItemService.addOrderItem(taoBaoOrder, order, rate);
                    hongBaoService.addHongBao(order, taoBaoOrder, orderItem.getId());
                }
            } else if (hongBaoList.size() > 0)// 原来已经存在订单了
            {
                List<TaobaoOrderHongBao> sortList = HongBaoUtil.sortHongBaoAndTaoBaoOrder(orderList, hongBaoList);
                orderList = new ArrayList<>();
                hongBaoList = new ArrayList<>();
                if (sortList != null)
                    for (TaobaoOrderHongBao tb : sortList) {
                        orderList.add(tb.taoBaoOrder);
                        hongBaoList.add(tb.hongBao);
                    }
                if (orderList.size() != hongBaoList.size()) {
                    LogHelper.userOrder("红包数和订单数不对等:" + orderId);
                    return;
                }
                for (int i = 0; i < orderList.size(); i++) {
                    hongBaoService.updateHongBao(hongBaoList.get(i), orderList.get(i));
                    orderItemService.updateOrderItem(orderList.get(i), hongBaoList.get(i).getOrderItemId(), rate);
                }
            }
        }
    }
    @Override
    @Transactional
    public void fanli(HongBao hb) throws TaoBaoWeiQuanException {
        // 查询最新的红包数据
        hb = hongBaoMapper.selectByPrimaryKeyForUpdate(hb.getId());
        // 维权中的不返利
        List<TaoBaoWeiQuanOrder> taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper
                .selectListByOrderIdAndState(hb.getOrderId(), "维权创建");
        if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0)
            return;
        taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper.selectListByOrderIdAndState(hb.getOrderId(), "等待处理");
        if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0)
            return;
        long currentTimeMillis = System.currentTimeMillis();
        if (hb.getState() != HongBao.STATE_SHIXIAO) {
            // 设置为已返利
            // 处理主红包
            if (hb.getState() != HongBao.STATE_SHIXIAO && hb.getState() != HongBao.STATE_YILINGQU
                    && hb.getType() == HongBao.TYPE_TAOBAO) {
                OrderItem orderItem = null;
                if (hb.getOrderItemId() != null) {
                    orderItem = orderItemMapper.selectByPrimaryKey(hb.getOrderItemId());
                    OrderItem updateOrderItem = new OrderItem();
                    updateOrderItem.setId(orderItem.getId());
                    updateOrderItem.setFanTime(currentTimeMillis);
                    updateOrderItem.setState(OrderItem.STATE_DAOZHANG);
                    orderItemMapper.updateByPrimaryKeySelective(updateOrderItem);
                }
                // 如果红包没被领取
                HongBao updateHongBao = new HongBao();
                updateHongBao.setId(hb.getId());
                updateHongBao.setState(HongBao.STATE_YILINGQU);
                updateHongBao.setGetTime(currentTimeMillis);
                hongBaoMapper.updateByPrimaryKeySelective(updateHongBao);
                userInfoMapper.addHongBaoByUid(hb.getUserInfo().getId(), hb.getMoney());
                // ...消息、明细
                HongBaoExtra hongBaoExtra = HongBaoUtil.convert(hb);
                // 明细操作(如果服务器性好了后,可改成异步)
                MoneyRecord moneyRecord = new MoneyRecord(hb.getUserInfo(), hb, hb.getMoney(), hongBaoExtra.getTitle(),
                        "", currentTimeMillis, 1);
                moneyRecordMapper.insertSelective(moneyRecord);
                AccountDetails accountDetails = AccountDetailsFactory.create("+" + hb.getMoney(),
                        AccountDetailsFactory.FANLI, orderItem, null, hb.getUserInfo());
                accountDetailsMapper.insertSelective(accountDetails);
                // 插入新版资金明细
                try {
                    UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createFanLi(hb.getUserInfo().getId(),
                            hb.getOrderId(), 1, hb.getId(), hb.getMoney());
                    userMoneyDetail.setId(accountDetails.getId());
                    userMoneyDetailMapper.insert(userMoneyDetail);
                } catch (UserMoneyDetailException e1) {
                    try {
                        LogHelper.errorDetailInfo(e1);
                    } catch (Exception e2) {
                        e2.printStackTrace();
                    }
                }
                // 添加资金明细与红包的映射关系
                accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(hb.getId(), accountDetails.getId());
                // 维权扣款(2018-08-05后开始实行)
                if (hb.getBalanceTime() != null
                        && hb.getBalanceTime().getTime() >= TimeUtil.convertToTimeTemp("2018-08-05", "yyyy-MM-dd")) {
                    taoBaoWeiQuanDrawBackService.doWeiQuanFanli(hb.getOrderId());
                }
                // 站内信+推送
                try {
                    userNotificationService.orderFanliRecieved(hb.getUserInfo().getId(), orderItem.getOrderId(),
                            orderItem.getFanMoney());
                } catch (Exception e) {
                }
            }
        }
    }
    @Resource
    private HongBaoOrderMapper hongBaoOrderMapper;
    @Override
    @Transactional
    public void fanli(HongBaoV2 hb) throws TaoBaoWeiQuanException {
    public void fanli(HongBaoV2 hb1) throws TaoBaoWeiQuanException {
        // 查询最新的红包数据
        hb = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hb.getId());
        hb1 = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hb1.getId());
        // 查询红包相关联的订单
        HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hb.getId());
        HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hb1.getId());
        if (hongBaoOrder == null) {
            LogHelper.error("返利失败:" + hb.getId());
            LogHelper.error("返利失败:" + hb1.getId());
            return;
        }
        // 维权中的不返利
@@ -602,57 +403,115 @@
        if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0)
            return;
        long currentTimeMillis = System.currentTimeMillis();
        if (hb.getState() != HongBao.STATE_SHIXIAO) {
            // 设置为已返利
            // 处理主红包
            if (hb.getState() != HongBaoV2.STATE_SHIXIAO && hb.getState() != HongBaoV2.STATE_YILINGQU
                    && hb.getType() == HongBaoV2.TYPE_ZIGOU) {
                // 如果红包没被领取
                HongBaoV2 updateHongBao = new HongBaoV2();
                updateHongBao.setId(hb.getId());
                updateHongBao.setState(HongBaoV2.STATE_YILINGQU);
                updateHongBao.setGetTime(new Date(currentTimeMillis));
                hongBaoV2Mapper.updateByPrimaryKeySelective(updateHongBao);
                userInfoMapper.addHongBaoByUid(hb.getUserInfo().getId(), hb.getMoney());
        // 查询同一订单号的红包
        List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(
                hongBaoOrder.getCommonOrder().getSourceType(), hongBaoOrder.getCommonOrder().getOrderNo());
        List<HongBaoV2> hongBaoList = new ArrayList<>();
        Map<Long, BigDecimal> userMoney = new HashMap<>();
        Map<Long, List<HongBaoV2>> userHongBao = new HashMap<>();
        Map<Long, Integer> userGoodsCount = new HashMap<>();
        // Map<Long, BigDecimal> userPayMent = new HashMap<>();
        for (CommonOrder co : orderList) {
            hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(co.getId());
            hongBaoList.add(hongBaoOrder.getHongBaoV2());
            Long uid = co.getUserInfo().getId();
            if (userGoodsCount.get(uid) == null)
                userGoodsCount.put(uid, co.getCount());
            else
                userGoodsCount.put(uid, Integer.valueOf(co.getCount() + userGoodsCount.get(uid)));
            // if (userPayMent.get(uid) == null)
            // userPayMent.put(uid, new BigDecimal(0));
            // if (co.getState() == CommonOrder.STATE_JS)
            // userPayMent.put(uid,
            // userPayMent.get(uid).add(co.getSettlement()));
            // else
            // userPayMent.put(uid, userPayMent.get(uid).add(co.getPayment()));
        }
                AccountDetails accountDetails = AccountDetailsFactory.create("+" + hb.getMoney(),
                        AccountDetailsFactory.FANLI, null, null, hb.getUserInfo());
                accountDetailsMapper.insertSelective(accountDetails);
        for (HongBaoV2 hb : hongBaoList) {
            long currentTimeMillis = System.currentTimeMillis();
            if (hb.getState() != HongBao.STATE_SHIXIAO) {
                // 设置为已返利
                // 处理主红包
                if (hb.getState() != HongBaoV2.STATE_SHIXIAO && hb.getState() != HongBaoV2.STATE_YILINGQU
                        && hb.getType() == HongBaoV2.TYPE_ZIGOU) {
                    // 如果红包没被领取
                    Long uid = hb.getUserInfo().getId();
                    HongBaoV2 updateHongBao = new HongBaoV2();
                    updateHongBao.setId(hb.getId());
                    updateHongBao.setState(HongBaoV2.STATE_YILINGQU);
                    updateHongBao.setGetTime(new Date(currentTimeMillis));
                    hongBaoV2Mapper.updateByPrimaryKeySelective(updateHongBao);
                    if (userMoney.get(uid) == null)
                        userMoney.put(uid, hb.getMoney());
                    else
                        userMoney.put(uid, userMoney.get(uid).add(hb.getMoney()));
                // 插入新版资金明细
                try {
                    UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createFanLi(hb.getUserInfo().getId(),
                            hongBaoOrder.getCommonOrder().getOrderNo(), hongBaoOrder.getCommonOrder().getSourceType(),
                            hb.getId(), hb.getMoney());
                    userMoneyDetail.setId(accountDetails.getId());
                    userMoneyDetailMapper.insert(userMoneyDetail);
                } catch (UserMoneyDetailException e1) {
                    try {
                        LogHelper.errorDetailInfo(e1);
                    } catch (Exception e2) {
                        e2.printStackTrace();
                    }
                    // 添加红包到用户
                    if (userHongBao.get(uid) == null)
                        userHongBao.put(uid, new ArrayList<>());
                    userHongBao.get(uid).add(hb);
                }
                // 添加资金明细与红包的映射关系
                accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(hb.getId(), accountDetails.getId());
                // 维权扣款(2018-08-05后开始实行)
                if (hongBaoOrder.getCommonOrder().getSettleTime() != null && hongBaoOrder.getCommonOrder()
                        .getSettleTime().getTime() >= TimeUtil.convertToTimeTemp("2018-08-05", "yyyy-MM-dd")) {
                    taoBaoWeiQuanDrawBackService.doWeiQuanFanli(hongBaoOrder.getCommonOrder().getOrderNo());
                }
                // 站内信+推送
                try {
                    userNotificationService.orderFanliRecieved(hb.getUserInfo().getId(),
                            hongBaoOrder.getCommonOrder().getOrderNo(), hb.getMoney());
                } catch (Exception e) {
                }
            }
        }
        Iterator<Long> its = userMoney.keySet().iterator();
        while (its.hasNext()) {
            // 将自己添加到用户
            Long uid = its.next();
            BigDecimal money = userMoney.get(uid);
            userInfoMapper.addHongBaoByUid(uid, money);
            AccountDetails accountDetails = AccountDetailsFactory.create("+" + money, AccountDetailsFactory.FANLI, null,
                    null, new UserInfo(uid));
            accountDetailsMapper.insertSelective(accountDetails);
            // 插入新版资金明细
            try {
                UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createFanLi(uid,
                        hongBaoOrder.getCommonOrder().getOrderNo(), hongBaoOrder.getCommonOrder().getSourceType(), null,
                        money);
                userMoneyDetail.setId(accountDetails.getId());
                userMoneyDetailMapper.insert(userMoneyDetail);
            } catch (UserMoneyDetailException e1) {
                try {
                    LogHelper.errorDetailInfo(e1);
                } catch (Exception e2) {
                    e2.printStackTrace();
                }
            }
            // 添加资金明细与红包的映射关系
            for (HongBaoV2 v2 : userHongBao.get(uid)) {
                accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(v2.getId(), accountDetails.getId());
            }
            // 站内信+推送
            UserInfo user = userInfoMapper.selectByPrimaryKey(uid);
            try {
                userNotificationService.orderFanliRecieved(uid, hongBaoOrder.getCommonOrder().getOrderNo(),
                        userGoodsCount.get(uid), user.getMyHongBao(), money);
            } catch (Exception e) {
                try {
                    LogHelper.errorDetailInfo(e);
                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
            // 新版通知
            userMoneyMsgNotificationService.fanliOrderReceived(uid, hongBaoOrder.getCommonOrder().getOrderNo(),
                    userGoodsCount.get(uid), money, user.getMyHongBao());
        }
        // 维权扣款(2018-08-05后开始实行)
        if (hongBaoOrder.getCommonOrder().getSettleTime() != null && hongBaoOrder.getCommonOrder().getSettleTime()
                .getTime() >= TimeUtil.convertToTimeTemp("2018-08-05", "yyyy-MM-dd")) {
            taoBaoWeiQuanDrawBackService.doWeiQuanFanli(hongBaoOrder.getCommonOrder().getOrderNo());
        }
    }
    @Override
@@ -745,6 +604,9 @@
        List<Long> hbIdList = new ArrayList<>();
        BigDecimal invitemoney = new BigDecimal(0);
        Set<String> inviteOrders = new HashSet<>();
        int inviteGoodsCount = 0;
        // 需要判断退款的订单号
        Set<String> drawBackOrders = new HashSet<String>();
        for (HongBaoV2 hongBao : hongBaoList) {
@@ -763,9 +625,12 @@
                hongBaoV2Mapper.updateByPrimaryKeySelective(updateHongBao);
                // 添加到红包返利记录集合
                hbIdList.add(hongBao.getId());
                // 2018-08-05 过后的订单才处理维权
                HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hongBao.getParent().getId());
                inviteGoodsCount += hongBaoOrder.getCommonOrder().getCount();
                inviteOrders.add(hongBaoOrder.getCommonOrder().getOrderNo());
                Date balanceTime = hongBaoOrder.getCommonOrder().getSettleTime();
                if (balanceTime != null
@@ -807,6 +672,8 @@
                hbIdList.add(hb.getId());
                HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hb.getParent().getId());
                inviteGoodsCount += hongBaoOrder.getCommonOrder().getCount();
                inviteOrders.add(hongBaoOrder.getCommonOrder().getOrderNo());
                if (!StringUtil.isNullOrEmpty(hongBaoOrder.getCommonOrder().getOrderNo()))
                    drawBackOrders.add(hongBaoOrder.getCommonOrder().getOrderNo());
            }
@@ -857,10 +724,16 @@
            // 发送推送
            try {
                // 提成到账消息通知
                userNotificationService.tiChengInviteRecieved(uid, invitemoney);
                userNotificationService.tiChengInviteRecieved(uid, inviteOrders.size(), inviteGoodsCount, null,
                        invitemoney);
            } catch (Exception e) {
                e.printStackTrace();
            }
            // 新版通知
            userMoneyMsgNotificationService.inviteOrderReceived(uid, inviteOrders.size(), inviteGoodsCount, invitemoney,
                    userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
            for (String orderId : drawBackOrders)
                taoBaoWeiQuanDrawBackService.doWeiQuanInvite(orderId);
        }
@@ -871,6 +744,9 @@
        /**
         * 处理分享赚
         */
        int shareGoodsCount = 0;
        Set<String> shareOrders = new HashSet<>();
        BigDecimal sharemoney = new BigDecimal(0);
        // 查询UID的分享赚订单
        types.clear();
@@ -896,6 +772,7 @@
                HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hongBao.getId());
                if (hongBaoOrder != null)
                    balanceTime = hongBaoOrder.getCommonOrder().getSettleTime();
                shareOrders.add(hongBaoOrder.getCommonOrder().getOrderNo());
                if (balanceTime != null
                        && balanceTime.getTime() >= TimeUtil.convertToTimeTemp("2018-08-05", "yyyy-MM-dd")) {
                    drawBackOrders.add(hongBaoOrder.getCommonOrder().getOrderNo());
@@ -951,10 +828,16 @@
            // 发送推送
            try {
                // 提成到账消息通知
                userNotificationService.tiChengShareRecieved(uid, sharemoney);
                userNotificationService.tiChengShareRecieved(uid, shareOrders.size(), shareGoodsCount, null,
                        sharemoney);
            } catch (Exception e) {
                e.printStackTrace();
            }
            // 新版通知
            userMoneyMsgNotificationService.shareOrderReceived(uid, shareOrders.size(), shareGoodsCount, sharemoney,
                    userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
            for (String orderId : drawBackOrders)
                taoBaoWeiQuanDrawBackService.doWeiQuanShare(orderId);
        }
fanli/src/main/java/com/yeshi/fanli/service/impl/order/PidOrderServiceImpl.java
@@ -309,14 +309,6 @@
                        }
                        
                        try {
                            // 第三方提成订单被统计的通知
                            userNotificationService.tiChengStatisticed(hongBao.getUserInfo().getId(),
                                    hongBao.getOrderId(), hongBao.getMoney());
                        } catch (Exception e) {
                        }
                        PidOrder updatePidOrder = new PidOrder();
                        updatePidOrder.setId(order.getId());
                        updatePidOrder.setLocalUpdateTime(new Date());
@@ -342,12 +334,7 @@
                                hongBao2.setOrderId(order.getOrderId());
                                hongBaoMapper.insertSelective(hongBao2);
                                try {
                                    // 第三方提成订单被统计的通知
                                    userNotificationService.tiChengStatisticed(hongBao2.getUserInfo().getId(),
                                            hongBao2.getOrderId(), hongBao2.getMoney());
                                } catch (Exception e) {
                                }
                            }
@@ -370,12 +357,6 @@
                                    hongBao3.setOrderId(order.getOrderId());
                                    hongBaoMapper.insertSelective(hongBao3);
                                    try {
                                        // 第三方提成订单被统计的通知
                                        userNotificationService.tiChengStatisticed(hongBao3.getUserInfo().getId(),
                                                hongBao3.getOrderId(), hongBao3.getMoney());
                                    } catch (Exception e) {
                                    }
                                }
                            }
                        }
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoWeiQuanDrawBackServiceImpl.java
@@ -33,6 +33,7 @@
import com.yeshi.fanli.exception.TaoBaoWeiQuanException;
import com.yeshi.fanli.exception.money.UserMoneyDetailException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanDrawBackService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanOrderService;
import com.yeshi.fanli.service.inter.user.UserNotificationService;
@@ -74,6 +75,9 @@
    @Resource
    private HongBaoOrderMapper hongBaoOrderMapper;
    @Resource
    private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
    @Override
    public void addWeiQuanDrawBack(TaoBaoWeiQuanDrawBack taoBaoWeiQuanDrawBack) {
@@ -197,6 +201,10 @@
                    e1.printStackTrace();
                }
            }
            // 新版通知
            userMoneyMsgNotificationService.fanliOrderWeiQuan(uid, orderId, drawBackMoney,
                    userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
            userNotificationService.weiQuanFanli(uid, orderId, drawBackMoney);
        }
@@ -325,6 +333,9 @@
                    e1.printStackTrace();
                }
            }
            userMoneyMsgNotificationService.shareOrderWeiQuan(uid, orderId, drawBackMoney,
                    userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
            userNotificationService.weiQuanTiCheng(uid, orderId, drawBackMoney);
        }
@@ -457,7 +468,9 @@
                }
            }
            //
            // 新版通知
            userMoneyMsgNotificationService.inviteOrderWeiQuan(uid, orderId, drawBackMoney,
                    userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
            userNotificationService.weiQuanTiCheng(uid, orderId, drawBackMoney);
        }
fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoWeiQuanOrderServiceImpl.java
@@ -8,13 +8,24 @@
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail.MsgTypeOrderTypeEnum;
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
import com.yeshi.fanli.service.inter.msg.MsgOrderDetailService;
import com.yeshi.fanli.service.inter.msg.UserOrderMsgNotificationService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanOrderService;
@Service
public class TaoBaoWeiQuanOrderServiceImpl implements TaoBaoWeiQuanOrderService {
    @Resource
    private TaoBaoWeiQuanOrderMapper taoBaoWeiQuanOrderMapper;
    @Resource
    private UserOrderMsgNotificationService userOrderMsgNotificationService;
    @Resource
    private MsgOrderDetailService msgOrderDetailService;
    @Override
    public void addWeiQuanOrder(TaoBaoWeiQuanOrder order) {
@@ -38,6 +49,26 @@
            update.setUpdateTime(new Date());
            update.setWeiQuanFinishTime(order.getWeiQuanFinishTime());
            taoBaoWeiQuanOrderMapper.updateByPrimaryKeySelective(update);
            try {
                if (order.getState().equalsIgnoreCase("维权成功")) {
                    List<MsgOrderDetail> msgList = msgOrderDetailService.listMsgOrderByOrderId(order.getOrderId());
                    for (MsgOrderDetail msg : msgList) {
                        if (msg.getType() == MsgTypeOrderTypeEnum.fanli) {
                            userOrderMsgNotificationService.orderFanLiStateChanged(msg.getUser().getId(),
                                    order.getOrderId(), null, null, CommonOrder.STATE_WQ);
                        } else if (msg.getType() == MsgTypeOrderTypeEnum.invite) {
                            userOrderMsgNotificationService.orderInviteStateChanged(msg.getUser().getId(),
                                    order.getOrderId(), null, null, CommonOrder.STATE_WQ);
                        } else if (msg.getType() == MsgTypeOrderTypeEnum.share) {
                            userOrderMsgNotificationService.orderShareStateChanged(msg.getUser().getId(),
                                    order.getOrderId(), null, null, CommonOrder.STATE_WQ);
                        }
                    }
                }
            } catch (Exception e) {
            }
        } else {
            order.setCreateTime(new Date());
            order.setUpdateTime(new Date());
fanli/src/main/java/com/yeshi/fanli/service/impl/user/ExtractServiceImpl.java
@@ -54,6 +54,7 @@
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.SystemConfigService;
import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
import com.yeshi.fanli.service.inter.push.PushService;
import com.yeshi.fanli.service.inter.user.AccountDetailsService;
import com.yeshi.fanli.service.inter.user.AccountMessageService;
@@ -154,6 +155,9 @@
    private UserMoneyDetailMapper userMoneyDetailMapper;
    @Resource
    private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
    @Resource
    private AlipayAccountValidNormalHistoryMapper alipayAccountValidNormalHistoryMapper;
    public List<Extract> getExtractInfoByUid(long uid) {
@@ -199,7 +203,7 @@
    @Transactional
    public synchronized void rejectExtract(long id, String reason, long extractTime, AdminUser admin)
            throws ObjectStateException, NotExistObjectException {
        Extract find = extractDao.find(Extract.class, id);
        Extract find = extractMapper.selectByPrimaryKey(id);
        if (find == null) {
            throw new NotExistObjectException("不存在该对象");
@@ -274,6 +278,9 @@
        } catch (Exception e) {
            e.printStackTrace();
        }
        // 新版通知
        userMoneyMsgNotificationService.extractFail(find, reason);
    }
    /**
@@ -331,6 +338,8 @@
        }
        userNotificationService.extractApply(extract.getUserInfo().getId());
        // 添加新版通知
        userMoneyMsgNotificationService.extractApplay(extract);
        if ("是".equals(autoExtract)) {
            LogHelper.userInfo("uid=" + user.getId() + ",提交转账申请!");
@@ -507,6 +516,8 @@
                e.printStackTrace();
            }
            // 新版提现
            userMoneyMsgNotificationService.extractFail(extract, null);
        }
    }
@@ -542,7 +553,8 @@
        } catch (Exception e) {
            e.printStackTrace();
        }
        // 新版通知
        userMoneyMsgNotificationService.extractSuccess(extract);
    }
    /**
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java
@@ -44,6 +44,7 @@
import com.yeshi.fanli.exception.UserAccountException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
import com.yeshi.fanli.service.inter.msg.UserAccountMsgNotificationService;
import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
import com.yeshi.fanli.service.inter.user.UserAccountService;
import com.yeshi.fanli.util.Constant;
@@ -51,6 +52,7 @@
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.factory.AccountDetailsFactory;
import com.yeshi.fanli.util.factory.msg.MsgAccountDetailFactory;
import com.yeshi.fanli.util.wx.WXLoginUtil;
import net.sf.json.JSONObject;
@@ -98,6 +100,9 @@
    @Resource
    private SpreadUserImgService spreadUserImgService;
    @Resource
    private UserAccountMsgNotificationService userAccountMsgNotificationService;
    @Transactional
    @Override
@@ -219,13 +224,17 @@
                            // 绑定关系
                            UserInfo updateUserInfo = new UserInfo(userInfo.getId());
                            if (!StringUtil.isNullOrEmpty(lastUser.getPhone()))
                            if (!StringUtil.isNullOrEmpty(lastUser.getPhone())) {
                                updateUserInfo.setPhone(lastUser.getPhone());
                                userAccountMsgNotificationService.bindingSuccess(userInfo.getId(),
                                        MsgAccountDetailFactory.TYPE_PHONE);
                            }
                            if (!StringUtil.isNullOrEmpty(lastUser.getOpenid())) {
                                updateUserInfo.setOpenid(lastUser.getOpenid());
                                updateUserInfo.setTbName(lastUser.getTbName());
                                updateUserInfo.setTbPic(lastUser.getTbPic());
                                userAccountMsgNotificationService.bindingSuccess(userInfo.getId(),
                                        MsgAccountDetailFactory.TYPE_TB);
                            }
                            updateUserInfo.setLastLoginTime(System.currentTimeMillis());
                            userInfoMapper.updateByPrimaryKeySelective(updateUserInfo);
@@ -532,6 +541,7 @@
            moneyRecordMapper.insertSelective(moneyRecord);
        }
        userAccountMsgNotificationService.connectSuccess(mainUser.getId(), lessUser.getId());
    }
    /**
@@ -657,6 +667,7 @@
        UserInfo update = new UserInfo(user.getId());
        update.setPhone(phone);
        userInfoMapper.updateByPrimaryKeySelective(update);
        userAccountMsgNotificationService.bindingSuccess(uid, MsgAccountDetailFactory.TYPE_PHONE);
    }
    @Override
@@ -677,6 +688,7 @@
        UserInfo updateUserInfo = new UserInfo(uid);
        updateUserInfo.setPhone("");
        userInfoMapper.updateByPrimaryKeySelective(updateUserInfo);
        userAccountMsgNotificationService.unBindingSuccess(uid, MsgAccountDetailFactory.TYPE_PHONE);
    }
    @Override
@@ -702,6 +714,8 @@
            update.setPortrait(tbPortrait);
        }
        userInfoMapper.updateByPrimaryKeySelective(update);
        userAccountMsgNotificationService.bindingSuccess(uid, MsgAccountDetailFactory.TYPE_TB);
    }
    @Override
@@ -726,6 +740,8 @@
        }
        userInfoMapper.updateByPrimaryKeySelective(update);
        userAccountMsgNotificationService.unBindingSuccess(uid, MsgAccountDetailFactory.TYPE_TB);
    }
    @Override
@@ -758,6 +774,8 @@
            updateUserInfo.setPortrait(Constant.systemCommonConfig.getDefaultPortrait());
        }
        userInfoMapper.updateByPrimaryKeySelective(updateUserInfo);
        userAccountMsgNotificationService.changeBindingSuccess(uid, MsgAccountDetailFactory.TYPE_WX);
    }
    @Override
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserNotificationServiceImpl.java
@@ -46,7 +46,7 @@
    }
    @Override
    public void orderFanliRecieved(Long uid, String orderId, BigDecimal money) {
    public void orderFanliRecieved(Long uid, String orderId, int goodsCount, BigDecimal balance, BigDecimal money) {
        if (Constant.IS_TEST)
            return;
        try {
@@ -70,7 +70,8 @@
    }
    @Override
    public void orderFanliStatisticed(Long uid, String orderId) {
    public void orderFanliStatisticed(Long uid, String orderId, int goodsCount, int orderState, BigDecimal payMoney,
            BigDecimal money) {
        if (Constant.IS_TEST)
            return;
        try {
@@ -222,7 +223,7 @@
    }
    @Override
    public void tiChengInviteRecieved(Long uid, BigDecimal money) {
    public void tiChengInviteRecieved(Long uid, int orderCount, int goodsCount, BigDecimal balance, BigDecimal money) {
        if (Constant.IS_TEST)
            return;
        try {
@@ -235,7 +236,7 @@
    }
    @Override
    public void tiChengShareRecieved(Long uid, BigDecimal money) {
    public void tiChengShareRecieved(Long uid, int orderCount, int goodsCount, BigDecimal balance, BigDecimal money) {
        if (Constant.IS_TEST)
            return;
        try {
@@ -248,7 +249,8 @@
    }
    @Override
    public void orderShareStatisticed(Long uid, String orderId, BigDecimal money) {
    public void orderShareStatisticed(Long uid, String orderId, int goodsCount, int orderState, BigDecimal payMoney,
            BigDecimal money) {
        if (Constant.IS_TEST)
            return;
        orderId = orderId.substring(0, orderId.length() - 6) + "******";
@@ -262,7 +264,8 @@
    }
    @Override
    public void orderInviteStatisticed(Long uid, String orderId, BigDecimal money) {
    public void orderInviteStatisticed(Long uid, String orderId, int goodsCount, int orderState, BigDecimal payMoney,
            BigDecimal money) {
        if (Constant.IS_TEST)
            return;
        orderId = orderId.substring(0, orderId.length() - 6) + "******";
@@ -272,7 +275,6 @@
        } catch (PushException e) {
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/goods/RecommendUserGoodsService.java
New file
@@ -0,0 +1,40 @@
package com.yeshi.fanli.service.inter.goods;
import java.util.List;
import com.yeshi.fanli.entity.goods.CommonGoods;
import com.yeshi.fanli.entity.goods.RecommendUserGoods;
import com.yeshi.fanli.exception.goods.RecommendUserGoodsException;
public interface RecommendUserGoodsService {
    /**
     * 添加商品推荐
     *
     * @param uid
     * @param recommendDesc
     *            推荐语
     * @param goodsList
     */
    public void addRecommend(Long uid, String recommendDesc, List<CommonGoods> goodsList)
            throws RecommendUserGoodsException;
    /**
     * 获取推荐列表
     *
     * @param uid
     * @param page
     * @param pageSize
     * @return
     */
    public List<RecommendUserGoods> listRecommend(Long uid, int page, int pageSize);
    /**
     * 获取推荐数量
     *
     * @param uid
     * @return
     */
    public long countRecommend(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/hongbao/HongBaoService.java
@@ -166,10 +166,6 @@
     */
    public void connectHongBaoAndOrderItem();
    public void addHongBao(Order order, TaoBaoOrder taoBaoOrder, Long orderItemId);
    public void updateHongBao(HongBao hongBao, TaoBaoOrder taoBaoOrder);
    /**
     * 累计提成订单数量(包含无效的订单)
     * 
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgAccountDetailService.java
New file
@@ -0,0 +1,42 @@
package com.yeshi.fanli.service.inter.msg;
import java.util.List;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
import com.yeshi.fanli.exception.msg.MsgAccountDetailException;
public interface MsgAccountDetailService {
    /**
     * 添加到账户消息
     *
     * @param detail
     * @throws MsgAccountDetailException
     */
    public void addMsgAccountDetail(MsgAccountDetail detail) throws MsgAccountDetailException;
    /**
     * 账户消息列表
     *
     * @param uid
     * @param page
     * @return
     */
    public List<MsgAccountDetail> listMsgAccountDetail(Long uid, int page);
    /**
     * 账户消息数
     *
     * @param uid
     * @return
     */
    public long countMsgAccountDetail(Long uid);
    /**
     * 设置所有消息已读
     *
     * @param uid
     */
    public void readMsgByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgInviteDetailService.java
New file
@@ -0,0 +1,40 @@
package com.yeshi.fanli.service.inter.msg;
import java.util.List;
import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
import com.yeshi.fanli.exception.msg.MsgInviteDetailException;
public interface MsgInviteDetailService {
    /**
     * 添加到邀请消息
     *
     * @param detail
     * @throws MsgInviteDetailException
     */
    public void addMsgInviteDetail(MsgInviteDetail detail) throws MsgInviteDetailException;
    /**
     * 账户消息列表
     *
     * @param uid
     * @param page
     * @return
     */
    public List<MsgInviteDetail> listMsgInviteDetail(Long uid, int page);
    /**
     * 账户消息数
     *
     * @param uid
     * @return
     */
    public long countMsgInviteDetail(Long uid);
    /**
     * 设置所有消息已读
     *
     * @param uid
     */
    public void readMsgByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgMoneyDetailService.java
New file
@@ -0,0 +1,40 @@
package com.yeshi.fanli.service.inter.msg;
import java.util.List;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
import com.yeshi.fanli.exception.msg.MsgMoneyDetailException;
public interface MsgMoneyDetailService {
    /**
     * 添加到资金消息
     *
     * @param detail
     * @throws MsgMoneyDetailException
     */
    public void addMsgMoneyDetail(MsgMoneyDetail detail) throws MsgMoneyDetailException;
    /**
     * 资金消息列表
     *
     * @param uid
     * @param page
     * @return
     */
    public List<MsgMoneyDetail> listMsgMoneyDetail(Long uid, int page);
    /**
     * 资金消息数
     *
     * @param uid
     * @return
     */
    public long countMsgMoneyDetail(Long uid);
    /**
     * 设置所有消息已读
     *
     * @param uid
     */
    public void readMsgByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/MsgOrderDetailService.java
New file
@@ -0,0 +1,54 @@
package com.yeshi.fanli.service.inter.msg;
import java.util.List;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
import com.yeshi.fanli.exception.msg.MsgOrderDetailException;
public interface MsgOrderDetailService {
    /**
     * 添加到订单消息
     *
     * @param detail
     * @throws MsgOrderDetailException
     */
    public void addMsgOrderDetail(MsgOrderDetail detail) throws MsgOrderDetailException;
    /**
     * 根据订单号用户ID更新数据
     *
     * @param detail
     * @throws MsgOrderDetailException
     */
    public void updateMsgOrderDetail(MsgOrderDetail detail) throws MsgOrderDetailException;
    /**
     * 订单消息列表
     *
     * @param uid
     * @param page
     * @return
     */
    public List<MsgOrderDetail> listMsgOrderDetail(Long uid, int page);
    /**
     * 根据订单号获取
     * @return
     */
    public List<MsgOrderDetail> listMsgOrderByOrderId(String orderId);
    /**
     * 订单消息数
     *
     * @param uid
     * @return
     */
    public long countMsgOrderDetail(Long uid);
    /**
     * 设置所有消息已读
     *
     * @param uid
     */
    public void readMsgByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserAccountMsgNotificationService.java
New file
@@ -0,0 +1,54 @@
package com.yeshi.fanli.service.inter.msg;
/**
 * 用户账户消息通知
 *
 * @author Administrator
 *
 */
public interface UserAccountMsgNotificationService {
    /**
     * 绑定成功
     *
     * @param uid
     * @param type
     */
    public void bindingSuccess(Long uid, int type);
    /**
     * 解绑成功
     *
     * @param uid
     * @param type
     */
    public void unBindingSuccess(Long uid, int type);
    /**
     * 取消绑定成功
     *
     * @param uid
     * @param type
     */
    public void changeBindingSuccess(Long uid, int type);
    /**
     * 账号合并成功
     *
     * @param uid
     * @param lessUid
     */
    public void connectSuccess(Long uid, Long lessUid);
    /**
     * 用户等级变化
     *
     * @param uid
     * @param orderType
     *            -订单类型(邀请订单/返利订单/分享订单)
     * @param orderCount
     * @param rankName
     */
    public void userRank(Long uid, String orderType, int orderCount, String rankName);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserInviteMsgNotificationService.java
New file
@@ -0,0 +1,36 @@
package com.yeshi.fanli.service.inter.msg;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
/**
 * 用户邀请消息通知
 *
 * @author Administrator
 *
 */
public interface UserInviteMsgNotificationService {
    /**
     * 二维码扫描
     *
     * @param uid
     * @param sale
     */
    public void inviteScan(Long uid, ThreeSale sale);
    /**
     * 邀请成功
     *
     * @param uid
     * @param sale
     */
    public void inviteSuccess(Long uid, ThreeSale sale);
    /**
     * 邀请失败
     *
     * @param uid
     * @param sale
     */
    public void inviteFail(Long uid, ThreeSale sale);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserMoneyMsgNotificationService.java
New file
@@ -0,0 +1,109 @@
package com.yeshi.fanli.service.inter.msg;
import java.math.BigDecimal;
import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
import com.yeshi.fanli.entity.bus.user.Extract;
/**
 * 用户资金消息通知
 *
 * @author Administrator
 *
 */
public interface UserMoneyMsgNotificationService {
    /**
     * 提现申请
     *
     * @param extract
     */
    public void extractApplay(Extract extract);
    /**
     * 提现失败
     *
     * @param extract
     * @param stateDesc
     */
    public void extractFail(Extract extract, String stateDesc);
    /**
     * 提现成功
     *
     * @param extract
     */
    public void extractSuccess(Extract extract);
    /**
     * 支付宝账号验证
     *
     * @param history
     */
    public void alipayAccountValid(AlipayAccountValidNormalHistory history);
    /**
     * 返利订单到账
     *
     * @param uid
     * @param orderId
     * @param goodsCount
     * @param money
     * @param balance
     */
    public void fanliOrderReceived(Long uid, String orderId, int goodsCount, BigDecimal money, BigDecimal balance);
    /**
     * 返利订单维权
     *
     * @param uid
     * @param orderId
     * @param money
     * @param balance
     */
    public void fanliOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance);
    /**
     * 分享赚订单被统计
     *
     * @param uid
     * @param orderCount
     * @param goodsCount
     * @param money
     * @param balance
     */
    public void shareOrderReceived(Long uid, int orderCount, int goodsCount, BigDecimal money, BigDecimal balance);
    /**
     * 分享订单维权
     *
     * @param uid
     * @param orderId
     * @param money
     * @param balance
     */
    public void shareOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance);
    /**
     * 邀请赚订单被统计
     *
     * @param uid
     * @param orderCount
     * @param goodsCount
     * @param money
     * @param balance
     */
    public void inviteOrderReceived(Long uid, int orderCount, int goodsCount, BigDecimal money, BigDecimal balance);
    /**
     * 邀请订单维权
     *
     * @param uid
     * @param orderId
     * @param money
     * @param balance
     */
    public void inviteOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserMsgReadStateService.java
New file
@@ -0,0 +1,102 @@
package com.yeshi.fanli.service.inter.msg;
import com.yeshi.fanli.entity.bus.msg.UserMsgUnReadNum;
/**
 * 消息未读服务
 *
 * @author Administrator
 *
 */
public interface UserMsgReadStateService {
    /**
     * 增加订单消息未读数
     *
     * @param uid
     * @param count
     */
    public void addOrderMsgUnReadCount(Long uid, int count);
    /**
     * 增加账号消息未读数
     *
     * @param uid
     * @param count
     */
    public void addAccountMsgUnReadCount(Long uid, int count);
    /**
     * 增加资金消息未读数
     *
     * @param uid
     * @param count
     */
    public void addMoneyMsgUnReadCount(Long uid, int count);
    /**
     * 增加邀请消息未读数
     *
     * @param uid
     * @param count
     */
    public void addInviteMsgUnReadCount(Long uid, int count);
    /**
     * 增加系统消息未读数
     *
     * @param uid
     * @param count
     */
    public void addSystemMsgUnReadCount(Long uid, int count);
    /**
     * 获取用户所有未读消息数
     *
     * @param uid
     * @return
     */
    public UserMsgUnReadNum getReadStateByUid(Long uid);
    /**
     * 设置所有消息已读
     *
     * @param uid
     */
    public void setAllMsgRead(Long uid);
    /**
     * 读订单消息
     *
     * @param uid
     */
    public void readOrderMsg(Long uid);
    /**
     * 读账号消息
     *
     * @param uid
     */
    public void readAccountMsg(Long uid);
    /**
     * 读资金消息
     *
     * @param uid
     */
    public void readMoneyMsg(Long uid);
    /**
     * 读邀请消息
     *
     * @param uid
     */
    public void readInviteMsg(Long uid);
    /**
     * 读系统消息
     *
     * @param uid
     */
    public void readUserSystemMsg(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserOrderMsgNotificationService.java
New file
@@ -0,0 +1,86 @@
package com.yeshi.fanli.service.inter.msg;
import java.math.BigDecimal;
/**
 * 用户订单消息通知
 *
 * @author Administrator
 *
 */
public interface UserOrderMsgNotificationService {
    /**
     * 返利订单统计
     *
     * @param uid
     * @param orderId
     * @param payMoney
     * @param money
     * @param goodsCount
     * @param orderState
     */
    public void orderFanLiStatistic(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int goodsCount,
            int orderState);
    /**
     * 返利订单状态改变
     *
     * @param uid
     * @param orderId
     * @param payMoney
     * @param money
     * @param orderState
     */
    public void orderFanLiStateChanged(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int orderState);
    /**
     * 分享订单统计
     *
     * @param uid
     * @param orderId
     * @param payMoney
     * @param money
     * @param goodsCount
     * @param orderState
     */
    public void orderShareStatistic(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int goodsCount,
            int orderState);
    /**
     * 分享订单状态改变
     *
     * @param uid
     * @param orderId
     * @param payMoney
     * @param money
     * @param orderState
     */
    public void orderShareStateChanged(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int orderState);
    /**
     * 邀请订单统计
     *
     * @param uid
     * @param orderId
     * @param payMoney
     * @param money
     * @param goodsCount
     * @param orderState
     */
    public void orderInviteStatistic(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int goodsCount,
            int orderState);
    /**
     * 邀请订单状态改变
     *
     * @param uid
     * @param orderId
     * @param payMoney
     * @param money
     * @param orderState
     */
    public void orderInviteStateChanged(Long uid, String orderId, BigDecimal payMoney, BigDecimal money,
            int orderState);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserSystemMsgService.java
New file
@@ -0,0 +1,73 @@
package com.yeshi.fanli.service.inter.msg;
import java.util.List;
import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
import com.yeshi.fanli.entity.bus.msg.UserSystemMsgTypeEnum;
import com.yeshi.fanli.entity.system.SystemZnx;
import com.yeshi.fanli.exception.msg.UserSystemMsgException;
/**
 * 用户系统消息
 *
 * @author Administrator
 *
 */
public interface UserSystemMsgService {
    /**
     * 添加系统消息
     *
     * @param uid
     * @param title
     * @param content
     * @param timeLevel
     *            -是否紧急
     * @param sz
     *            -站内信对应表
     */
    public void addUserSystemMsg(Long uid, UserSystemMsgTypeEnum type, String title, String content, int timeTag,
            SystemZnx sz) throws UserSystemMsgException;
    /**
     * 获取最近一次的系统消息
     *
     * @param uid
     * @return
     */
    public UserSystemMsg getLatestUserSystemMsg(Long uid);
    /**
     * 用户系统消息列表
     *
     * @param uid
     * @param page
     * @param pageSize
     * @return
     */
    public List<UserSystemMsg> listUserSystemMsg(Long uid, int page, int pageSize);
    /**
     * 用户系统消息数
     *
     * @param uid
     * @return
     */
    public long countUserSystemMsg(Long uid);
    /**
     * 设置系统消息解决了
     *
     * @param uid
     * @param id
     * @throws UserSystemMsgException
     */
    public void setSystemMsgSolved(Long uid, Long id) throws UserSystemMsgException;
    /**
     * 设置所有消息已读
     *
     * @param uid
     */
    public void readMsgByUid(Long uid);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/OrderProcessService.java
@@ -31,8 +31,6 @@
     */
    public void processShopingFanliOrder(Map<String, List<TaoBaoOrder>> orders);
    public void processShopingFanliOrder(String orderId, List<TaoBaoOrder> orderList)
            throws HongBaoException, OrderItemException;
    /**
     * 处理分享商品订单
@@ -57,14 +55,7 @@
     */
    public void fanli();
    /**
     * 购物返利
     *
     * @param hongBao
     *            type=1的主红包
     */
    public void fanli(HongBao hongBao) throws TaoBaoWeiQuanException;
    
    /**
     * 购物返利
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserNotificationService.java
@@ -21,13 +21,19 @@
    public void newerHongBao(Long uid, BigDecimal money);
    /**
     * 订单返利到账
     * 返利到账通知
     * 
     * @param uid
     *            -用户ID
     * @param orderId
     * @param money
     *            -订单号
     * @param goodsCount
     *            -商品数量
     * @param balance-账户余额
     * @param money-返利资金
     */
    public void orderFanliRecieved(Long uid, String orderId, BigDecimal money);
    public void orderFanliRecieved(Long uid, String orderId, int goodsCount, BigDecimal balance,
            BigDecimal money);
    /**
     * 提成到账
@@ -38,28 +44,39 @@
    public void tiChengRecieved(Long uid, BigDecimal money);
    /**
     * 邀请提成到账
     * 邀请到账
     * 
     * @param uid
     * @param money
     * @param orderCount-订单数
     * @param goodsCount-商品数
     * @param balance-账户余额
     * @param money-资金
     */
    public void tiChengInviteRecieved(Long uid, BigDecimal money);
    public void tiChengInviteRecieved(Long uid, int orderCount, int goodsCount, BigDecimal balance, BigDecimal money);
    /**
     * 分享提成到账
     * 
     * @param uid
     * @param orderCount
     * @param goodsCount
     * @param balance
     * @param money
     */
    public void tiChengShareRecieved(Long uid, BigDecimal money);
    public void tiChengShareRecieved(Long uid, int orderCount, int goodsCount, BigDecimal balance, BigDecimal money);
    /**
     * 订单被统计
     * 
     * @param uid
     * @param orderId
     * @param goodsCount-商品数
     * @param orderState-订单状态
     * @param payMoney-付款金额
     * @param money-佣金
     */
    public void orderFanliStatisticed(Long uid, String orderId);
    public void orderFanliStatisticed(Long uid, String orderId, int goodsCount, int orderState, BigDecimal payMoney,
            BigDecimal money);
    /**
     * 提成订单被统计
@@ -68,25 +85,33 @@
     * @param orderId
     * @param money
     */
    public void tiChengStatisticed(Long uid, String orderId, BigDecimal money);
    public void tiChengStatisticed(Long uid, String orderId,BigDecimal money);
    /**
     * 分享订单被统计
     * 
     * @param uid
     * @param orderId
     * @param goodsCount
     * @param orderState
     * @param payMoney
     * @param money
     */
    public void orderShareStatisticed(Long uid, String orderId, BigDecimal money);
    public void orderShareStatisticed(Long uid, String orderId, int goodsCount, int orderState, BigDecimal payMoney,
            BigDecimal money);
    /**
     * 邀请订单被统计
     * 
     * @param uid
     * @param orderId
     * @param goodsCount
     * @param orderState
     * @param payMoney
     * @param money
     */
    public void orderInviteStatisticed(Long uid, String orderId, BigDecimal money);
    public void orderInviteStatisticed(Long uid, String orderId, int goodsCount, int orderState, BigDecimal payMoney,
            BigDecimal money);
    /**
     * 维权返利订单扣款
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -86,8 +86,7 @@
        if (Constant.IS_TASK) {
            doExtractResult();// 处理提现结果
            doTaoBaoOrders();// 处理淘宝订单
            doOrderFanLi();// 处理订单返利
            doOrderFanLiNew();//新版返利
            doOrderFanLiNew();// 新版返利
            doOrderTiChengFanLi();// 处理订单提成返利
            doWeiQuanOrder();// 处理维权订单
            doPushIOS();// 处理发送IOS消息
@@ -178,47 +177,6 @@
                }
            });
        }
    }
    /**
     * 处理淘宝订单返利
     */
    public void doOrderFanLi() {
        executor.execute(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    try {
                        Map<String, HongBao> map = CMQManager.getInstance().consumeFanLiMsg(16);
                        if (map != null) {
                            Iterator<String> its = map.keySet().iterator();
                            while (its.hasNext()) {
                                String handler = its.next();
                                try {
                                    orderProcessService.fanli(map.get(handler));
                                    CMQManager.getInstance().deleteFanLiMsg(handler);
                                } catch (TaoBaoWeiQuanException e) {
                                    try {
                                        LogHelper.errorDetailInfo(e);
                                    } catch (Exception e1) {
                                        e1.printStackTrace();
                                    }
                                } catch (Exception e) {
                                    try {
                                        LogHelper.errorDetailInfo(e);
                                    } catch (Exception e1) {
                                        e1.printStackTrace();
                                    }
                                }
                            }
                        }
                    } catch (Exception e) {
                    }
                }
            }
        });
    }
    /**
fanli/src/main/java/com/yeshi/fanli/util/TaoBaoHttpUtil.java
@@ -204,13 +204,12 @@
                url += String.format("%s=%s&", key, URLEncoder.encode(params.get(key), "UTF-8"));
            }
            //System.out.println("url"+url);
            // System.out.println("url"+url);
            GetMethod method = new GetMethod(url);
            //3S的响应超时
            HttpConnectionManagerParams hparams = new
                      HttpConnectionManagerParams();
                      hparams.setConnectionTimeout(3000);
                      client.getHttpConnectionManager().setParams(hparams);
            // 3S的响应超时
            HttpConnectionManagerParams hparams = new HttpConnectionManagerParams();
            hparams.setConnectionTimeout(3000);
            client.getHttpConnectionManager().setParams(hparams);
            /*
             * if(proxy){ Address address = ProxyUtil.getAddressProxy();
@@ -274,10 +273,11 @@
    }
    public static String taoKeGet(Map<String, String> params) {
        // 聚石塔服务器环境  118.178.179.189
        String result = get("http://118.178.179.189/taoke/", params, false);
        if (StringUtil.isNullOrEmpty(result))
            result = get("http://gw.api.taobao.com/router/rest", params, false);
        // 聚石塔服务器环境 118.178.179.189
        // result = get("http://118.178.179.189/taoke/", params, false);
        // if (StringUtil.isNullOrEmpty(result))
        String result = get("http://gw.api.taobao.com/router/rest", params, false);
        return result;
    }
fanli/src/main/java/com/yeshi/fanli/util/account/UserUtil.java
@@ -1,9 +1,13 @@
package com.yeshi.fanli.util.account;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.beanutils.PropertyUtils;
import com.yeshi.fanli.entity.bus.user.BindingAccount;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
@@ -61,8 +65,106 @@
        if (rank == null)
            rank = 0;
        return String.format(Constant.systemCommonConfig.getBaseUserRankIconUrl() + "/rank_picture_%s.png",
                rank + "");
        return String.format(Constant.systemCommonConfig.getBaseUserRankIconUrl() + "/rank_picture_%s.png", rank + "");
    }
    public static String getInviteCode(Long uid) {
        long num = 1000000000L + uid;
        return convert10To36(num);
    }
    private static String convert10To36(Long num) {
        String numbers = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        BigDecimal numBig = new BigDecimal(num);
        int ge = numBig.divideAndRemainder(new BigDecimal(36))[1].intValue();
        int n = 1;
        String result = "";
        result += numbers.charAt(ge);
        while (numBig.divideAndRemainder(new BigDecimal(36).pow(n))[0].compareTo(new BigDecimal(0)) > 0) {
            int w = numBig.divideAndRemainder(new BigDecimal(36).pow(n))[0].divideAndRemainder(new BigDecimal(36))[1]
                    .intValue();
            result = numbers.charAt(w) + result;
            n++;
        }
        return result;
    }
    /**
     * 过滤支付宝账号,中间用*代替
     *
     * @param bindingAccountList
     * @return
     */
    public static List<BindingAccount> filterBindingAccount(List<BindingAccount> bindingAccountList) {
        List<BindingAccount> accountList = new ArrayList<>();
        if (bindingAccountList != null)
            for (BindingAccount bindingAccount : bindingAccountList) {
                accountList.add(filterBindingAccount(bindingAccount));
            }
        return accountList;
    }
    public static BindingAccount filterBindingAccount(BindingAccount bindingAccount) {
        BindingAccount dest = new BindingAccount();
        try {
            PropertyUtils.copyProperties(dest, bindingAccount);
            if (!StringUtil.isNullOrEmpty(dest.getAccount()) && !StringUtil.isNullOrEmpty(dest.getName())) {
                String name = "";
                if ((dest.getName() + "").length() > 2)
                    for (int i = 0; i < (dest.getName() + "").length(); i++) {
                        if (i == 0)
                            name += dest.getName().charAt(i);
                        else
                            name += "*";
                    }
                else
                    name = dest.getName().charAt(0) + "*";
                dest.setName(name);
                String account = "";
                if (dest.getAccount().indexOf("@") > -1) {// 邮箱
                    int index = dest.getAccount().indexOf("@");
                    for (int i = 0; i < dest.getAccount().length(); i++) {
                        if (i < 3 || i >= index)
                            account += dest.getAccount().charAt(i);
                        else
                            account += "*";
                    }
                } else if (StringUtil.isMobile(dest.getAccount())) {// 电话
                    account = dest.getAccount().substring(0, 3) + "*****"
                            + dest.getAccount().substring(dest.getAccount().length() - 2, dest.getAccount().length());
                } else {// 其他
                    if (dest.getAccount().length() >= 6) {
                        for (int i = 0; i < dest.getAccount().length(); i++) {
                            if (i < 3 || i >= dest.getAccount().length() - 2)
                                account += dest.getAccount().charAt(i);
                            else
                                account += "*";
                        }
                    } else {
                        for (int i = 0; i < dest.getAccount().length(); i++) {
                            if (i < 1 || i >= dest.getAccount().length() - 1)
                                account += dest.getAccount().charAt(i);
                            else
                                account += "*";
                        }
                    }
                }
                dest.setAccount(account);
            }
        } catch (Exception e) {
        }
        return dest;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgAccountDetailFactory.java
@@ -1,8 +1,16 @@
package com.yeshi.fanli.util.factory.msg;
import java.util.Date;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.util.StringUtil;
public class MsgAccountDetailFactory {
    public final static int TYPE_WX = 1;// 微信
    public final static int TYPE_TB = 2;// 淘宝
    public final static int TYPE_PHONE = 3;// 电话
    /**
     * 账号绑定成功
@@ -12,8 +20,25 @@
     * @return
     */
    public static MsgAccountDetail createBindingAccount(Long uid, int type) {
        return null;
        String msg = "";
        if (type == TYPE_PHONE) {
            msg = "<highlight>恭喜你手机号绑定成功</highlight>";
        } else if (type == TYPE_TB) {
            msg = "<highlight>恭喜你淘宝绑定成功</highlight>";
        } else if (type == TYPE_WX) {
            msg = "<highlight>恭喜你微信绑定成功</highlight>";
        }
        if (StringUtil.isNullOrEmpty(msg))
            return null;
        MsgAccountDetail detail = new MsgAccountDetail();
        detail.setBeiZhu("无");
        detail.setContent(msg);
        detail.setTitle("绑定账号");
        detail.setType(MsgTypeAccountTypeEnum.bingding);
        detail.setUser(new UserInfo(uid));
        detail.setCreateTime(new Date());
        detail.setRead(false);
        return detail;
    }
    /**
@@ -24,8 +49,25 @@
     * @return
     */
    public static MsgAccountDetail createUnBindingAccount(Long uid, int type) {
        return null;
        String msg = "";
        if (type == TYPE_PHONE) {
            msg = "<highlight>手机号解绑成功</highlight>";
        } else if (type == TYPE_TB) {
            msg = "<highlight>淘宝解绑成功</highlight>";
        } else if (type == TYPE_WX) {
            msg = "<highlight>微信解绑成功</highlight>";
        }
        if (StringUtil.isNullOrEmpty(msg))
            return null;
        MsgAccountDetail detail = new MsgAccountDetail();
        detail.setBeiZhu("无");
        detail.setContent(msg);
        detail.setTitle("解绑账号");
        detail.setType(MsgTypeAccountTypeEnum.cancelBinding);
        detail.setUser(new UserInfo(uid));
        detail.setCreateTime(new Date());
        detail.setRead(false);
        return detail;
    }
    /**
@@ -36,8 +78,67 @@
     * @return
     */
    public static MsgAccountDetail createChangeBindingAccount(Long uid, int type) {
        String msg = "";
        if (type == TYPE_PHONE) {
            msg = "<highlight>手机号更换绑定成功</highlight>";
        } else if (type == TYPE_TB) {
            msg = "<highlight>淘宝更换绑定成功</highlight>";
        } else if (type == TYPE_WX) {
            msg = "<highlight>微信更换绑定成功</highlight>";
        }
        if (StringUtil.isNullOrEmpty(msg))
            return null;
        MsgAccountDetail detail = new MsgAccountDetail();
        detail.setBeiZhu("无");
        detail.setContent(msg);
        detail.setTitle("更换绑定账号");
        detail.setType(MsgTypeAccountTypeEnum.bingdingChange);
        detail.setUser(new UserInfo(uid));
        detail.setCreateTime(new Date());
        detail.setRead(false);
        return detail;
    }
        return null;
    /**
     * 账号打通
     *
     * @param mainUid
     * @param lessUid
     * @return
     */
    public static MsgAccountDetail createConnectAccount(Long mainUid, Long lessUid) {
        if (mainUid == null || lessUid == null)
            return null;
        String msg = String.format("恭喜你账号合并成功,由“<highlight>%s</highlight>”合并到“<highlight>%s</highlight>”", lessUid + "",
                mainUid + "");
        MsgAccountDetail detail = new MsgAccountDetail();
        detail.setBeiZhu("无");
        detail.setContent(msg);
        detail.setTitle("账号合并");
        detail.setType(MsgTypeAccountTypeEnum.connect);
        detail.setUser(new UserInfo(mainUid));
        detail.setCreateTime(new Date());
        detail.setRead(false);
        return detail;
    }
    // 账号等级
    public static MsgAccountDetail createUserRank(Long uid, String orderType, int orderCount, String rankName) {
        if (uid == null || rankName == null)
            return null;
        String msg = String.format(
                "恭喜你,上月<highlight>%s</highlight>订单达到<highlight>%s</highlight>单,已为你升级为<highlight>%s</highlight>用户,将会获得对应的福利和特权。",
                orderType, orderCount + "", rankName);
        MsgAccountDetail detail = new MsgAccountDetail();
        detail.setBeiZhu("无");
        detail.setContent(msg);
        detail.setTitle("账号等级");
        detail.setType(MsgTypeAccountTypeEnum.level);
        detail.setUser(new UserInfo(uid));
        detail.setCreateTime(new Date());
        detail.setRead(false);
        return detail;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgInviteDetailFactory.java
@@ -1,5 +1,88 @@
package com.yeshi.fanli.util.factory.msg;
import java.util.Date;
import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail.MsgTypeInviteTypeEnum;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.util.StringUtil;
public class MsgInviteDetailFactory {
    /**
     * 邀请成功
     *
     * @param threeSale
     * @param uid
     * @return
     */
    public static MsgInviteDetail createInviteSuccess(ThreeSale threeSale, Long uid, String beiZhu) {
        if (threeSale == null || uid == null)
            return null;
        MsgInviteDetail detail = new MsgInviteDetail();
        if (StringUtil.isNullOrEmpty(beiZhu))
            detail.setBeiZhu("无");
        else
            detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setDesc("恭喜你,成功邀请一个队员");
        detail.setInviteUser(threeSale);
        detail.setMsgType(MsgTypeInviteTypeEnum.invite);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
    /**
     * 扫描邀请二维码成功,但是未登录
     *
     * @param threeSale
     * @param uid
     * @return
     */
    public static MsgInviteDetail createInviteScanSuccess(ThreeSale threeSale, Long uid, String beiZhu) {
        if (threeSale == null || uid == null)
            return null;
        MsgInviteDetail detail = new MsgInviteDetail();
        if (StringUtil.isNullOrEmpty(beiZhu))
            detail.setBeiZhu("无");
        else
            detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setDesc("恭喜你,有新队员加入你的队列,若对方60天内未激活将会与你脱离邀请关系");
        detail.setInviteUser(threeSale);
        detail.setMsgType(MsgTypeInviteTypeEnum.invite);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
    /**
     * 邀请失败
     *
     * @param threeSale
     * @param uid
     * @return
     */
    public static MsgInviteDetail createInviteFail(ThreeSale threeSale, Long uid, String beiZhu) {
        if (threeSale == null || uid == null)
            return null;
        MsgInviteDetail detail = new MsgInviteDetail();
        if (StringUtil.isNullOrEmpty(beiZhu))
            detail.setBeiZhu("无");
        else
            detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setDesc("抱歉,该队员因60天内未激活,已脱离了你的队列,可以试着重新邀请");
        detail.setInviteUser(threeSale);
        detail.setMsgType(MsgTypeInviteTypeEnum.invite);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgMoneyDetailFactory.java
@@ -1,5 +1,282 @@
package com.yeshi.fanli.util.factory.msg;
import java.math.BigDecimal;
import java.util.Date;
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;
public class MsgMoneyDetailFactory {
    /**
     * 提现申请消息
     *
     * @param extract
     * @param uid
     * @param beiZhu
     * @return
     */
    public static MsgMoneyDetail createExtractApplyMsg(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 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;
    }
    /**
     * 账号验证消息
     *
     * @param valid
     * @param uid
     * @param beiZhu
     * @return
     */
    public static MsgMoneyDetail createAlipayAccountValidMsg(AlipayAccountValidNormalHistory valid, Long uid,
            String company, BigDecimal money, String beiZhu) {
        if (valid == null || uid == null || company == null)
            return null;
        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));
        return detail;
    }
    /**
     * 返利到账
     *
     * @param money
     * @param balance
     * @param orderId
     * @param goodsCount
     * @param uid
     * @param beiZhu
     * @return
     */
    public static MsgMoneyDetail createFailiMsg(BigDecimal money, BigDecimal balance, String orderId, int goodsCount,
            Long uid, String beiZhu) {
        if (money == null || balance == null || orderId == 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.fanli);
        detail.setOrderId(orderId);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
    /**
     * 返利维权
     *
     * @param uid
     * @param orderId
     * @param money
     * @param balance
     * @param beiZhu
     * @return
     */
    public static MsgMoneyDetail createFailiWeiQuanMsg(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.fanliWeiQuan);
        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 createInviteMsg(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.invite);
        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 createInviteWeiQuanMsg(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.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.setRead(false);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgOrderDetailFactory.java
@@ -1,5 +1,105 @@
package com.yeshi.fanli.util.factory.msg;
import java.math.BigDecimal;
import java.util.Date;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail.MsgTypeOrderTypeEnum;
import com.yeshi.fanli.entity.bus.user.UserInfo;
public class MsgOrderDetailFactory {
    /**
     * 返利订单
     *
     * @param uid
     * @param orderId
     * @param goodsCount
     * @param orderState
     * @param payMoney
     * @param money
     * @param state
     * @param beiZhu
     * @return
     */
    public static MsgOrderDetail createFanLiOrder(Long uid, String orderId, int goodsCount, int orderState,
            BigDecimal payMoney, BigDecimal money, String beiZhu) {
        if (payMoney == null || money == null || uid == null)
            return null;
        MsgOrderDetail detail = new MsgOrderDetail();
        detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setGoodsCount(goodsCount);
        detail.setHongBaoMoney(money);
        detail.setOrderId(orderId);
        detail.setPayMoney(payMoney);
        detail.setRead(false);
        detail.setState(orderState);
        detail.setType(MsgTypeOrderTypeEnum.fanli);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
    /**
     * 邀请订单
     *
     * @param uid
     * @param orderId
     * @param goodsCount
     * @param orderState
     * @param payMoney
     * @param money
     * @param state
     * @param beiZhu
     * @return
     */
    public static MsgOrderDetail createInviteOrder(Long uid, String orderId, int goodsCount, int orderState,
            BigDecimal payMoney, BigDecimal money, String beiZhu) {
        if (payMoney == null || money == null || uid == null)
            return null;
        MsgOrderDetail detail = new MsgOrderDetail();
        detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setGoodsCount(goodsCount);
        detail.setHongBaoMoney(money);
        detail.setOrderId(orderId);
        detail.setPayMoney(payMoney);
        detail.setRead(false);
        detail.setState(orderState);
        detail.setType(MsgTypeOrderTypeEnum.invite);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
    /**
     * 分享订单
     *
     * @param uid
     * @param orderId
     * @param goodsCount
     * @param orderState
     * @param payMoney
     * @param money
     * @param state
     * @param beiZhu
     * @return
     */
    public static MsgOrderDetail createShareOrder(Long uid, String orderId, int goodsCount, int orderState,
            BigDecimal payMoney, BigDecimal money, String beiZhu) {
        if (payMoney == null || money == null || uid == null)
            return null;
        MsgOrderDetail detail = new MsgOrderDetail();
        detail.setBeiZhu(beiZhu);
        detail.setCreateTime(new Date());
        detail.setGoodsCount(goodsCount);
        detail.setHongBaoMoney(money);
        detail.setOrderId(orderId);
        detail.setPayMoney(payMoney);
        detail.setRead(false);
        detail.setState(orderState);
        detail.setType(MsgTypeOrderTypeEnum.share);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java
@@ -1,31 +1,409 @@
package com.yeshi.fanli.util.factory.msg;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
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;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail.MsgTypeOrderTypeEnum;
import com.yeshi.fanli.entity.bus.user.BindingAccount;
import com.yeshi.fanli.entity.bus.user.Extract;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.StringUtil;
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.UserMsgVO;
public class UserMsgVOFactory {
    private final static String COLOR_TITLE = "#888888";
    private final static String COLOR_CONTENT = "#000000";
    private final static String COLOR_HIGHLIGHT_CONTENT = "#E5005C";
    /**
     * 订单消息
     *
     * @param msg
     * @return
     */
    public static UserMsgVO create(MsgOrderDetail msg) {
        return null;
        List<CommonMsgItemVO> items = new ArrayList<>();
        List<ClientTextStyleVO> contentList = new ArrayList<>();
        contentList.add(new ClientTextStyleVO(msg.getOrderId(), "#000000"));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单号", "#888888"), contentList));
        contentList = new ArrayList<>();
        contentList.add(new ClientTextStyleVO("共", "#000000"));
        contentList.add(new ClientTextStyleVO(msg.getGoodsCount() + "", "#E5005C"));
        contentList.add(new ClientTextStyleVO("件商品", "#000000"));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("商品数量", "#888888"), contentList));
        contentList = new ArrayList<>();
        contentList.add(new ClientTextStyleVO(msg.getType().getDesc(), "#000000"));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单类型", "#888888"), contentList));
        contentList = new ArrayList<>();
        if (msg.getState() == MsgOrderDetail.STATE_FK)
            contentList.add(new ClientTextStyleVO("已付款", "#E5005C"));
        else if (msg.getState() == MsgOrderDetail.STATE_JS)
            contentList.add(new ClientTextStyleVO("已收货", "#E5005C"));
        else if (msg.getState() == MsgOrderDetail.STATE_SX)
            contentList.add(new ClientTextStyleVO("未付款/已退款", "#E5005C"));
        else if (msg.getState() == MsgOrderDetail.STATE_WQ)
            contentList.add(new ClientTextStyleVO("已维权", "#E5005C"));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单状态", "#888888"), contentList));
        contentList = new ArrayList<>();
        contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getPayMoney()), "#E5005C"));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("付款金额", "#888888"), contentList));
        contentList = new ArrayList<>();
        contentList
                .add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getHongBaoMoney()), "#E5005C"));
        if (msg.getType() == MsgTypeOrderTypeEnum.fanli)
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利金额", "#888888"), contentList));
        else if (msg.getType() == MsgTypeOrderTypeEnum.share)
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("分享奖金", "#888888"), contentList));
        else if (msg.getType() == MsgTypeOrderTypeEnum.invite)
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请奖金", "#888888"), contentList));
        contentList = new ArrayList<>();
        contentList.add(
                new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(), "#000000"));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", "#888888"), contentList));
        return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_order.png", "订单消息",
                msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
    }
    /**
     * 资金消息
     *
     * @param msg
     * @return
     */
    public static UserMsgVO create(MsgMoneyDetail msg) {
        List<CommonMsgItemVO> items = new ArrayList<>();
        List<ClientTextStyleVO> contentList = new ArrayList<>();
        // 提现
        if (msg.getMsgType() == MsgTypeMoneyTypeEnum.extract) {
            BindingAccount ba = new BindingAccount();
            ba.setAccount(msg.getExtract().getAccount());
            ba.setName(msg.getExtract().getName());
            ba = UserUtil.filterBindingAccount(ba);
            contentList.add(new ClientTextStyleVO("支付宝:" + ba.getName() + " " + ba.getAccount(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现账号", COLOR_CONTENT), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getExtract().getMoney()),
                    COLOR_HIGHLIGHT_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现金额", "#888888"), contentList));
            contentList = new ArrayList<>();
            if (msg.getExtract().getState() == Extract.STATE_NOT_PROCESS
                    || msg.getExtract().getState() == Extract.STATE_PROCESSING)
                contentList.add(new ClientTextStyleVO("人工审核中", COLOR_HIGHLIGHT_CONTENT));
            else if (msg.getExtract().getState() == Extract.STATE_PASS)
                contentList.add(new ClientTextStyleVO("已通过", COLOR_HIGHLIGHT_CONTENT));
            else if (msg.getExtract().getState() == Extract.STATE_REJECT)
                contentList.add(new ClientTextStyleVO("提现被拒绝", COLOR_HIGHLIGHT_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现状态", "#888888"), contentList));
            contentList = new ArrayList<>();
            if (msg.getExtract().getState() == Extract.STATE_NOT_PROCESS
                    || msg.getExtract().getState() == Extract.STATE_PROCESSING)
                contentList.add(new ClientTextStyleVO("无", COLOR_CONTENT));
            else if (msg.getExtract().getState() == Extract.STATE_PASS)
                contentList.add(new ClientTextStyleVO("无", COLOR_CONTENT));
            else if (msg.getExtract().getState() == Extract.STATE_REJECT)
                contentList.add(new ClientTextStyleVO(msg.getExtract().getReason(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态说明", "#888888"), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(
                    TimeUtil.getGernalTime(msg.getExtract().getExtractTime(), "yyyy-MM-dd HH:mm"), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("预计到账", "#888888"), contentList));
            if (msg.getExtract().getState() == Extract.STATE_PASS) {//
                contentList = new ArrayList<>();
                contentList.add(new ClientTextStyleVO(
                        TimeUtil.getGernalTime(msg.getExtract().getReceiveTime().getTime(), "yyyy-MM-dd HH:mm"),
                        COLOR_CONTENT));
                items.add(new CommonMsgItemVO(new ClientTextStyleVO("实际到账", "#888888"), contentList));
            }
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", "#888888"), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_extract.png", "提现",
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.extractValid) {
            BindingAccount ba = new BindingAccount();
            ba.setAccount(msg.getAlipayAccountValid().getAccount());
            ba.setName(msg.getAlipayAccountValid().getName());
            ba = UserUtil.filterBindingAccount(ba);
            // 支付宝验证
            contentList.add(new ClientTextStyleVO("支付宝:" + ba.getName() + " " + ba.getAccount(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现账号", COLOR_CONTENT), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getMoney()),
                    COLOR_HIGHLIGHT_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现金额", "#888888"), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥验证成功", COLOR_HIGHLIGHT_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("验证状态", "#888888"), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(msg.getStateDesc(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态说明", "#888888"), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", "#888888"), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_extract.png", "提现账号验证",
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.fanli) {
            // 返利到账
            contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利订单", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("共", COLOR_CONTENT));
            contentList.add(new ClientTextStyleVO(msg.getGoodsCount() + "", COLOR_HIGHLIGHT_CONTENT));
            contentList.add(new ClientTextStyleVO("件商品", COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("商品数量", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getMoney()) + "",
                    COLOR_HIGHLIGHT_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利金额", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getBalance()) + "",
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("账号余额", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_fanli.png", "返利到账",
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.invite || msg.getMsgType() == MsgTypeMoneyTypeEnum.share) {
            // 邀请奖金,分享奖金
            contentList.add(new ClientTextStyleVO(msg.getOrderCount() + "", COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单数量", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("共", COLOR_CONTENT));
            contentList.add(new ClientTextStyleVO(msg.getGoodsCount() + "", COLOR_HIGHLIGHT_CONTENT));
            contentList.add(new ClientTextStyleVO("件商品", COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("奖金商品", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getMoney()) + "",
                    COLOR_HIGHLIGHT_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("到账金额", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getBalance()) + "",
                    COLOR_HIGHLIGHT_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("账号余额", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            Calendar ca = Calendar.getInstance();
            ca.setTime(msg.getCreateTime());
            ca.add(Calendar.MONTH, -1);
            String date = ca.get(Calendar.YEAR) + "年" + (ca.get(Calendar.MONTH) + 1) + "月";
            if (msg.getMsgType() == MsgTypeMoneyTypeEnum.share)
                return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_share_money.png",
                        date + msg.getMsgType().getDesc(),
                        msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
            else
                new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite_money.png",
                        date + msg.getMsgType().getDesc(),
                        msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.fanliWeiQuan) {
            contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利订单", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("订单维权", COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("扣除说明", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getMoney()) + "",
                    COLOR_HIGHLIGHT_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利扣除", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getBalance()) + "",
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("账号余额", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_fanli.png", msg.getMsgType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.shareWeiQuan) {
            contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请订单", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("订单维权", COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("扣除说明", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getMoney()) + "",
                    COLOR_HIGHLIGHT_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("奖金扣除", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getBalance()) + "",
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("账号余额", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_share.png", msg.getMsgType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.inviteWeiQuan) {
            contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请订单", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("订单维权", COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("扣除说明", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getMoney()) + "",
                    COLOR_HIGHLIGHT_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("奖金扣除", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getBalance()) + "",
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("账号余额", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                    COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite.png", msg.getMsgType().getDesc(),
                    msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
        }
        return null;
    }
    /**
     * 账号消息
     *
     * @param msg
     * @return
     */
    public static UserMsgVO create(MsgAccountDetail msg) {
        List<CommonMsgItemVO> items = new ArrayList<>();
        List<ClientTextStyleVO> contentList = new ArrayList<>();
        return null;
        contentList.add(new ClientTextStyleVO(msg.getType().getDesc() + "", COLOR_CONTENT));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("事项", COLOR_TITLE), contentList));
        // 状态修改
        contentList = new ArrayList<>();
        int fromIndex = 0;
        int toIndex = 0;
        String stateDesc = msg.getContent();
        while (stateDesc.indexOf("<highlight>") > -1) {
            fromIndex = stateDesc.indexOf("<highlight>");
            toIndex = stateDesc.indexOf("</highlight>");
            String content1 = stateDesc.substring(0, fromIndex);
            String content2 = stateDesc.substring(fromIndex + "<highlight>".length(), toIndex);
            stateDesc = stateDesc.substring(toIndex + "</highlight>".length(), stateDesc.length());
            if (!StringUtil.isNullOrEmpty(content1)) {
                contentList.add(new ClientTextStyleVO(content1, COLOR_CONTENT));
            }
            if (!StringUtil.isNullOrEmpty(content2)) {
                contentList.add(new ClientTextStyleVO(content2, COLOR_HIGHLIGHT_CONTENT));
            }
        }
        if (!StringUtil.isNullOrEmpty(stateDesc)) {
            contentList.add(new ClientTextStyleVO(stateDesc, COLOR_CONTENT));
        }
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
        contentList = new ArrayList<>();
        contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu() + "",
                COLOR_CONTENT));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
        return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_account.png", msg.getType().getDesc(),
                msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
    }
    /**
     * 邀请消息
     *
     * @param msg
     * @return
     */
    public static UserMsgVO create(MsgInviteDetail msg) {
        List<CommonMsgItemVO> items = new ArrayList<>();
        List<ClientTextStyleVO> contentList = new ArrayList<>();
        return null;
        contentList.add(new ClientTextStyleVO(msg.getInviteUser().getWorker().getNickName() + "", COLOR_CONTENT,
                msg.getInviteUser().getWorker().getPortrait()));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("被邀请人", COLOR_TITLE), contentList));
        contentList = new ArrayList<>();
        contentList.add(new ClientTextStyleVO(msg.getDesc() + "", COLOR_HIGHLIGHT_CONTENT));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("说明", COLOR_TITLE), contentList));
        contentList = new ArrayList<>();
        contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
                COLOR_CONTENT));
        items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
        return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite.png", msg.getMsgType().getDesc(),
                msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
    }
}
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/msg/MsgTypeAccountTypeEnumHandler.java
New file
@@ -0,0 +1,53 @@
package com.yeshi.fanli.util.mybatishandler.msg;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
public class MsgTypeAccountTypeEnumHandler extends BaseTypeHandler<MsgTypeAccountTypeEnum> {
    @Override
    public MsgTypeAccountTypeEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            return MsgTypeAccountTypeEnum.valueOf(key);
        }
    }
    @Override
    public MsgTypeAccountTypeEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return MsgTypeAccountTypeEnum.valueOf(key);
        }
    }
    @Override
    public MsgTypeAccountTypeEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return MsgTypeAccountTypeEnum.valueOf(key);
        }
    }
    @Override
    public void setNonNullParameter(PreparedStatement arg0, int arg1, MsgTypeAccountTypeEnum arg2, JdbcType arg3)
            throws SQLException {
        arg0.setString(arg1, arg2.name());
    }
}
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/msg/MsgTypeInviteTypeEnumHandler.java
New file
@@ -0,0 +1,53 @@
package com.yeshi.fanli.util.mybatishandler.msg;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail.MsgTypeInviteTypeEnum;
public class MsgTypeInviteTypeEnumHandler extends BaseTypeHandler<MsgTypeInviteTypeEnum> {
    @Override
    public MsgTypeInviteTypeEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            return MsgTypeInviteTypeEnum.valueOf(key);
        }
    }
    @Override
    public MsgTypeInviteTypeEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return MsgTypeInviteTypeEnum.valueOf(key);
        }
    }
    @Override
    public MsgTypeInviteTypeEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return MsgTypeInviteTypeEnum.valueOf(key);
        }
    }
    @Override
    public void setNonNullParameter(PreparedStatement arg0, int arg1, MsgTypeInviteTypeEnum arg2, JdbcType arg3)
            throws SQLException {
        arg0.setString(arg1, arg2.name());
    }
}
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/msg/MsgTypeMoneyTypeEnumHandler.java
New file
@@ -0,0 +1,53 @@
package com.yeshi.fanli.util.mybatishandler.msg;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
public class MsgTypeMoneyTypeEnumHandler extends BaseTypeHandler<MsgTypeMoneyTypeEnum> {
    @Override
    public MsgTypeMoneyTypeEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            return MsgTypeMoneyTypeEnum.valueOf(key);
        }
    }
    @Override
    public MsgTypeMoneyTypeEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return MsgTypeMoneyTypeEnum.valueOf(key);
        }
    }
    @Override
    public MsgTypeMoneyTypeEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return MsgTypeMoneyTypeEnum.valueOf(key);
        }
    }
    @Override
    public void setNonNullParameter(PreparedStatement arg0, int arg1, MsgTypeMoneyTypeEnum arg2, JdbcType arg3)
            throws SQLException {
        arg0.setString(arg1, arg2.name());
    }
}
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/msg/MsgTypeOrderTypeEnumHandler.java
New file
@@ -0,0 +1,53 @@
package com.yeshi.fanli.util.mybatishandler.msg;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail.MsgTypeOrderTypeEnum;
public class MsgTypeOrderTypeEnumHandler extends BaseTypeHandler<MsgTypeOrderTypeEnum> {
    @Override
    public MsgTypeOrderTypeEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            return MsgTypeOrderTypeEnum.valueOf(key);
        }
    }
    @Override
    public MsgTypeOrderTypeEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return MsgTypeOrderTypeEnum.valueOf(key);
        }
    }
    @Override
    public MsgTypeOrderTypeEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return MsgTypeOrderTypeEnum.valueOf(key);
        }
    }
    @Override
    public void setNonNullParameter(PreparedStatement arg0, int arg1, MsgTypeOrderTypeEnum arg2, JdbcType arg3)
            throws SQLException {
        arg0.setString(arg1, arg2.name());
    }
}
fanli/src/main/java/com/yeshi/fanli/util/mybatishandler/msg/UserSystemMsgTypeEnumHandler.java
New file
@@ -0,0 +1,53 @@
package com.yeshi.fanli.util.mybatishandler.msg;
import java.sql.CallableStatement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.apache.ibatis.type.BaseTypeHandler;
import org.apache.ibatis.type.JdbcType;
import com.yeshi.fanli.entity.bus.msg.UserSystemMsgTypeEnum;
public class UserSystemMsgTypeEnumHandler extends BaseTypeHandler<UserSystemMsgTypeEnum> {
    @Override
    public UserSystemMsgTypeEnum getNullableResult(ResultSet arg0, String arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            return UserSystemMsgTypeEnum.valueOf(key);
        }
    }
    @Override
    public UserSystemMsgTypeEnum getNullableResult(ResultSet arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return UserSystemMsgTypeEnum.valueOf(key);
        }
    }
    @Override
    public UserSystemMsgTypeEnum getNullableResult(CallableStatement arg0, int arg1) throws SQLException {
        String key = arg0.getString(arg1);
        if (arg0.wasNull()) {
            return null;
        } else {
            // 根据数据库中的key值,定位SexEnum子类
            return UserSystemMsgTypeEnum.valueOf(key);
        }
    }
    @Override
    public void setNonNullParameter(PreparedStatement arg0, int arg1, UserSystemMsgTypeEnum arg2, JdbcType arg3)
            throws SQLException {
        arg0.setString(arg1, arg2.name());
    }
}
fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -25,6 +25,7 @@
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import org.fanli.TaoKeTest;
import org.yeshi.utils.taobao.TbImgUtil;
import net.sf.json.JSONArray;
@@ -158,6 +159,7 @@
        map.put("method", "taobao.tbk.item.info.get");
        map.put("num_iids", id + "");
        String resultStr = TaoKeBaseUtil.baseRequestForThreeTimes(map, true);
//        System.out.println(resultStr);
        JSONObject data = JSONObject.fromObject(resultStr);
        // 商品下架
        if (data.optJSONObject("error_response") != null && data.optJSONObject("error_response").optInt("code") == 15
@@ -219,6 +221,8 @@
            if (item.optBoolean("free_shipment"))
                goods.setFreeShipment(1);
            System.out.println(item.optString("material_lib_type"));
            return goods;
        }
@@ -322,7 +326,9 @@
                if (item.optBoolean("free_shipment"))
                    goods.setFreeShipment(1);
                if("1".equalsIgnoreCase(item.optString("material_lib_type")))
                    TaoKeTest.count++;
                goodsList.add(goods);
            }
        }
@@ -1437,6 +1443,7 @@
    /**
     * 从淘宝链接中解析商品ID(高级接口)
     *
     * @param link
     * @return
     */
@@ -1452,8 +1459,37 @@
        }
        if (resultJSON == null)
            return null;
        return null;
    }
    /**
     * 渠道邀请码
     *
     * @param relationId
     * @return
     */
    public static String getInviteCode(Long relationId, String accessToken) {
        Map<String, String> map = new HashMap<>();
        map.put("method", "taobao.tbk.sc.invitecode.get");
        map.put("session", accessToken);
        map.put("relation_id", relationId + "");
        map.put("code_type", "2");
        map.put("relation_app", "返利券");
        JSONObject resultJSON = null;
        try {
            TaoKeAppInfo app=new TaoKeAppInfo();
            app.setAppKey("24567001");
            app.setAppSecret("e26a8d0f8726883d44bf04742829b533");
            app.setAdzoneId("123123");
            resultJSON = TaoKeBaseUtil.baseRequest(map, app);
        } catch (TaoKeApiException e) {
            e.printStackTrace();
        }
        if (resultJSON == null)
            return null;
        return null;
    }
fanli/src/main/java/com/yeshi/fanli/vo/msg/ClientTextStyleVO.java
@@ -3,12 +3,31 @@
public class ClientTextStyleVO {
    private String content;
    private String color;
    private String img;
    public ClientTextStyleVO(String content, String color) {
        this.content = content;
        this.color = color;
    }
    public ClientTextStyleVO(String content, String color, String img) {
        this.content = content;
        this.color = color;
        this.img = img;
    }
    public ClientTextStyleVO(String img) {
        this.img = img;
    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    public ClientTextStyleVO() {
    }
fanli/src/main/java/com/yeshi/fanli/vo/msg/UserHomeMsgVO.java
New file
@@ -0,0 +1,67 @@
package com.yeshi.fanli.vo.msg;
import java.util.List;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
public class UserHomeMsgVO {
    public final static String TYPE_WELCOME = "welcome";
    public final static String TYPE_GOODS_1 = "goods_1";
    public final static String TYPE_GOODS_2 = "goods_2";
    public final static String TYPE_GOODS_3 = "goods_3";
    private String icon;
    private String type;
    private String title;
    private String content;
    private String createTime;
    private List<TaoBaoGoodsBrief> goodsList;
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getCreateTime() {
        return createTime;
    }
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
    public List<TaoBaoGoodsBrief> getGoodsList() {
        return goodsList;
    }
    public void setGoodsList(List<TaoBaoGoodsBrief> goodsList) {
        this.goodsList = goodsList;
    }
    public String getIcon() {
        return icon;
    }
    public void setIcon(String icon) {
        this.icon = icon;
    }
}
fanli/src/main/java/com/yeshi/fanli/vo/msg/UserSystemMsgVO.java
New file
@@ -0,0 +1,104 @@
package com.yeshi.fanli.vo.msg;
public class UserSystemMsgVO {
    private Long id;
    private String portrait;
    private String type;
    private Boolean solved;
    private String title;
    private String content;
    private String timeTag;
    private String createTime;
    private int unReadCount;
    public UserSystemMsgVO(Long id, String type, Boolean solved, String title, String content, String timeTag,
            String portrait, String createTime, int unReadCount) {
        this.id = id;
        this.type = type;
        this.solved = solved;
        this.title = title;
        this.content = content;
        this.timeTag = timeTag;
        this.portrait = portrait;
        this.createTime = createTime;
        this.unReadCount = unReadCount;
    }
    public UserSystemMsgVO() {
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public int getUnReadCount() {
        return unReadCount;
    }
    public void setUnReadCount(int unReadCount) {
        this.unReadCount = unReadCount;
    }
    public String getPortrait() {
        return portrait;
    }
    public void setPortrait(String portrait) {
        this.portrait = portrait;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public Boolean getSolved() {
        return solved;
    }
    public void setSolved(Boolean solved) {
        this.solved = solved;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getTimeTag() {
        return timeTag;
    }
    public void setTimeTag(String timeTag) {
        this.timeTag = timeTag;
    }
    public String getCreateTime() {
        return createTime;
    }
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
}
fanli/src/test/java/org/fanli/TBImgTest.java
@@ -14,7 +14,7 @@
    @Test
    public void test1() {
        List<ImageInfo> list = TaoBaoUtil.getTBDetailImageWithSizev2(565204406588L,new ProxyIP("175.25.184.247", 23128));
        List<ImageInfo> list = TaoBaoUtil.getTBDetailImageWithSizev2(565204406588L,new ProxyIP("180.104.85.109", 4248));
        for (ImageInfo info : list)
            System.out.println(info.getPicture());
    }
fanli/src/test/java/org/fanli/TaoKeTest.java
@@ -3,15 +3,17 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import org.junit.Ignore;
import org.junit.Test;
import com.yeshi.fanli.entity.taobao.SearchFilter;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
import com.yeshi.fanli.entity.taobao.TaoKeAppInfo;
import com.yeshi.fanli.exception.taobao.TaoKeApiException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException;
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
@@ -20,13 +22,34 @@
import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
@Ignore
//@Ignore
public class TaoKeTest {
    public static int count=0;
    @Test
    public void test1() {
        TaoBaoSearchResult result = TaoKeApiUtil.guessDeviceLike(1, 20, "", "A12CD85A-95B3-42B2-A042-5B42BF1A7094");
        System.out.println(result);
        SearchFilter sf = new SearchFilter();
        sf.setPage(3);
        sf.setPageSize(40);
        sf.setKey("鞋套");
        TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf);
        List<TaoBaoGoodsBrief> goodsList = result.getTaoBaoGoodsBriefs();
        List<Long> list=new ArrayList<>();
        for (TaoBaoGoodsBrief tf : goodsList) {
            list.add(tf.getAuctionId()) ;
        }
        try {
            TaoKeApiUtil.getBatchGoodsInfo(list);
        } catch (TaoKeApiException e1) {
            e1.printStackTrace();
        } catch (TaobaoGoodsDownException e1) {
            e1.printStackTrace();
        }
        System.out.println(count);
    }
    @Test
@@ -64,10 +87,11 @@
            List<TaoBaoOrder> list = TaoBaoOrderUtil.parseOrder(
                    new FileInputStream(new File("C:/Users/Administrator/Desktop/淘宝订单/2018.1.10-2018-03-12 (2).xls")));
            for (int i = 0; i < list.size(); i++) {
//                if (TimeUtil.convertToTimeTemp(list.get(i).getCreateTime(), "yyyy-MM-dd HH:mm:ss") > 1522339200000l) {
//                    list.remove(i);
//                    i--;
//                }
                // if (TimeUtil.convertToTimeTemp(list.get(i).getCreateTime(),
                // "yyyy-MM-dd HH:mm:ss") > 1522339200000l) {
                // list.remove(i);
                // i--;
                // }
            }
            taoBaoOrderService.addTaoBaoOrderList(list);
@@ -76,4 +100,9 @@
            e.printStackTrace();
        }
    }
    @Test
    public void test5() {
        TaoKeApiUtil.parseAuctionIdFromLink("https://m.tb.cn/h.3skbzZd?sm=e15385");
    }
}