| | |
| | | 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.entity.bus.msg.MsgAccountDetail;
|
| | | 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.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.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
|
| | | 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";
|
| | |
|
| | | /**
|
| | | * 获取订单消息列表
|
| | | *
|
| | |
| | | * @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:
|
| | | msgOrderDetailService.readMsgByUid(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:
|
| | | msgMoneyDetailService.readMsgByUid(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:
|
| | | msgAccountDetailService.readMsgByUid(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:
|
| | | msgInviteDetailService.readMsgByUid(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 = new ArrayList<>();
|
| | | 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 = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("邀请订单", "#000000"));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单类型", "#888888"), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("已付款", "#E5005C"));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单状态", "#888888"), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥58", "#E5005C"));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("付款金额", "#888888"), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥0.36", "#E5005C"));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请奖金", "#888888"), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | 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(Date.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());
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("data", data);
|
| | | root.put("count", 1);
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | }
|
| | |
|
| | | 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());
|
| | | }
|
| | | }
|
| | | });
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("data", builder.create().toJson(list));
|
| | | root.put("count", 1);
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | |
|
| | | return builder;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 邀请消息
|
| | | * 获取首页消息
|
| | | *
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param page
|
| | | * @param out
|
| | | */
|
| | |
|
| | | @RequestMapping(value = "getInviteMsgList", method = RequestMethod.POST)
|
| | | public void getInviteMsgList(AcceptData acceptData, Long uid, int page, PrintWriter 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<UserMsgVO> list = new ArrayList<>();
|
| | | List<UserHomeMsgVO> volist = new ArrayList<>();
|
| | | List<RecommendUserGoods> list = recommendUserGoodsService.listRecommend(uid, page, Constant.PAGE_SIZE);
|
| | | long count = recommendUserGoodsService.countRecommend(uid) + 1;// 计算欢迎语的数量
|
| | |
|
| | | for (int i = 0; i < 20; i++) {
|
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | ThreeSale ts = new ThreeSale();
|
| | | UserInfo worker = new UserInfo(438965L);
|
| | | worker.setPortrait("https://g2.ykimg.com/051400005A38ADC2ADBAC3A4BB0C648E");
|
| | | worker.setNickName("呵呵");
|
| | | ts.setWorker(worker);
|
| | | detail.setInviteUser(ts);
|
| | | detail.setDesc("恭喜你,有新队员加入你的队列,若对方60天内未激活将会与你脱离邀请关系");
|
| | | detail.setBeiZhu("无");
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.invite);
|
| | | list.add(UserMsgVOFactory.create(detail));
|
| | | 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);
|
| | | volist.add(vo);
|
| | | }
|
| | |
|
| | | GsonBuilder builder = new GsonBuilder();
|
| | | 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");
|
| | | }
|
| | | }
|
| | | });
|
| | | if (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) {
|
| | | 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())));
|
| | | }
|
| | | 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() + ""));
|
| | | }
|
| | | long count = userSystemMsgService.countUserSystemMsg(uid);
|
| | |
|
| | | userSystemMsgService.readMsgByUid(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(""));
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | 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>{ |
| | | |
| | | |
| | | } |
New file |
| | |
| | | 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); |
| | | } |
| | |
| | | */ |
| | | Long countByUid(@Param("uid") Long uid); |
| | | |
| | | /** |
| | | * 设置消息已读时 |
| | | * |
| | | * @param uid |
| | | */ |
| | | void setMsgReadByUid(Long uid); |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | Long countByUid(@Param("uid") Long uid); |
| | | |
| | | /** |
| | | * 设置消息已读时 |
| | | * |
| | | * @param uid |
| | | */ |
| | | void setMsgReadByUid(Long uid); |
| | | |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | List<MsgOrderDetail> 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); |
| | | |
| | | } |
New file |
| | |
| | | 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>{ |
| | | |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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;
|
| | |
|
| | | /*
|
| | |
| | | private Long id;
|
| | | @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")
|
| | |
| | | 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;
|
| | |
|
| | |
| | | */
|
| | | @Table("yeshi_ec_msg_system")
|
| | | public class UserSystemMsg {
|
| | | @Column(name="ms_id")
|
| | | 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")
|
| | | @Column(name = "ms_uid")
|
| | | private UserInfo user;
|
| | | @Column(name="ms_type")
|
| | | @Expose
|
| | | @Column(name = "ms_type")
|
| | | private UserSystemMsgTypeEnum type;// 消息类型
|
| | | @Column(name="ms_system_znx_id")
|
| | | @Column(name = "ms_system_znx_id")
|
| | | private SystemZnx systemZNX;// 系统统一广播的站内信,当有系统站内信时,标题内容等为空
|
| | | @Column(name="ms_read")
|
| | | @Column(name = "ms_read")
|
| | | @Expose
|
| | | private Boolean read;// 是否已读
|
| | | @Column(name="ms_solved")
|
| | | @Expose
|
| | | @Column(name = "ms_solved")
|
| | | private Boolean solved;// 是否已经解决
|
| | | @Column(name="ms_title")
|
| | | @Column(name = "ms_title")
|
| | | @Expose
|
| | | private String title;// 标题
|
| | | @Column(name="ms_content")
|
| | | @Column(name = "ms_content")
|
| | | @Expose
|
| | | private String content;// 内容
|
| | | @Column(name="ms_time_tag")
|
| | | @Column(name = "ms_time_tag")
|
| | | @Expose
|
| | | private Integer timeTag;// 时间标识:1-紧急 0-普通
|
| | | @Column(name="ms_create_time")
|
| | | @Expose
|
| | | @Column(name = "ms_create_time")
|
| | | private Date createTime;
|
| | | @Column(name="ms_update_time")
|
| | | @Column(name = "ms_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public Long getId() {
|
| | |
| | | @Column(name = "avnh_createtime")
|
| | | private Date createTime;
|
| | |
|
| | | public AlipayAccountValidNormalHistory(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public AlipayAccountValidNormalHistory() {
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
| | | @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")
|
| | |
| | | @Expose
|
| | | @org.yeshi.utils.mybatis.Column(name = "adminId")
|
| | | private Long adminId; // 任务id 目前默认值
|
| | | |
| | | //TODO 等待添加字段
|
| | | private Date receiveTime;//到账时间
|
| | |
|
| | | // TODO 等待添加字段
|
| | | private Date receiveTime;// 到账时间
|
| | |
|
| | | public Date getReceiveTime() {
|
| | | return receiveTime;
|
| | |
| | | @Column(name = "id")
|
| | | private Long id;
|
| | |
|
| | | public ThreeSale(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | | |
| | | public ThreeSale() {
|
| | | }
|
| | |
|
| | | @ManyToOne
|
| | | @JoinColumn(name = "boss_id")
|
| | | @Column(name = "boss_id")
|
New file |
| | |
| | | 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;
|
| | | }
|
| | | }
|
New file |
| | |
| | | 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;
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | @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;
|
| | | }
|
| | |
|
| | |
| | | this.content = content;
|
| | | }
|
| | |
|
| | | public long getCreateTime() {
|
| | | public Long getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(long createTime) {
|
| | | public void setCreateTime(Long createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
New file |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | 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; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | <?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> |
New file |
| | |
| | | <?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> |
| | |
| | | <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" |
| | | <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_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"> |
| | | <association property="user" column="ma_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="ma_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | |
| | | </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> |
| | |
| | | <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" |
| | | <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_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="mi_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | |
| | | <association property="inviteUser" column="mi_invite_id"> |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <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 property="worker" column="worker_id" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <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"> |
| | | <association property="user" column="mi_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="mi_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_msg_invite where mi_invite_id = #{0} |
| | | , |
| | | t.* |
| | | from yeshi_ec_msg_invite left join yeshi_ec_threesale t on |
| | | t.id=mi_invite_id where mi_invite_id = #{0} |
| | | </select> |
| | | |
| | | |
| | |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | count(mi_id) |
| | | from yeshi_ec_msg_invite where mi_uid |
| | | = #{0} |
| | | from yeshi_ec_msg_invite where mi_uid= |
| | | #{uid} |
| | | </select> |
| | | |
| | | |
| | |
| | | </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> |
| | |
| | | <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"> |
| | | <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" |
| | | <association property="extract" column="mm_source_id_extract" |
| | | select="com.yeshi.fanli.dao.mybatis.ExtractMapper.selectByPrimaryKey"> |
| | | </association> |
| | | <association property="alipayAccountValid" column="mm_source_id" |
| | | <association property="alipayAccountValid" column="mm_source_id_alipayvalid" |
| | | select="com.yeshi.fanli.dao.mybatis.AlipayAccountValidNormalHistoryMapper.selectByPrimaryKey"> |
| | | </association> |
| | | </resultMap> |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="selectBySourceIdAndMsgType" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | <select id="selectBySourceIdAndMsgType" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_msg_money where mm_source_id = |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="listByUid" resultMap="BaseResultMap" parameterType="java.lang.Long"> |
| | | <select id="listByUid" resultMap="BaseResultMap" > |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | <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> |
| | |
| | | </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> |
| | |
| | | <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"> |
| | | <association property="user" column="mo_uid" javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="mo_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | |
| | | </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> |
New file |
| | |
| | | <?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> |
| | |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="mrs_update_time" property="updateTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <association property="user" column="mrs_uid"> |
| | | <association property="user" column="mrs_uid" javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="mrs_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | </resultMap> |
| | |
| | | <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"> |
| | | <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"> |
| | | <id column="ms_system_znx_id" property="id" jdbcType="BIGINT" /> |
| | | <association property="systemZNX" column="ms_system_znx_id" |
| | | select="com.yeshi.fanli.dao.mybatis.msg.SystemZnxMapper.selectByPrimaryKey"> |
| | | </association> |
| | | |
| | | </resultMap> |
| | |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_msg_system where ms_id = #{id,jdbcType=BIGINT} |
| | | 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_msg_system where ms_id = #{id,jdbcType=BIGINT} |
| | | 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_msg_system |
| | | 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_msg_system |
| | | 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> |
| | |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.UserSystemMsg">update |
| | | yeshi_ec_msg_system set ms_uid = #{user.id,jdbcType=BIGINT},ms_type = |
| | | 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 = |
| | |
| | | #{updateTime,jdbcType=TIMESTAMP} where ms_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.UserSystemMsg"> |
| | | update yeshi_ec_msg_system |
| | | 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> |
| | |
| | | </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> |
New file |
| | |
| | | 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);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return msgAccountDetailMapper.countByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void readMsgByUid(Long uid) {
|
| | | msgAccountDetailMapper.setMsgReadByUid(uid);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | 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 {
|
| | |
| | |
|
| | | @Override
|
| | | public List<MsgInviteDetail> listMsgInviteDetail(Long uid, int page) {
|
| | | return null;
|
| | | return msgInviteDetailMapper.listByUid(uid, (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countMsgInviteDetail(Long uid) {
|
| | | return 0;
|
| | | return msgInviteDetailMapper.countByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void readMsgByUid(Long uid) {
|
| | | msgInviteDetailMapper.setMsgReadByUid(uid);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | 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 {
|
| | |
| | | }
|
| | |
|
| | | } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.extractValid) {
|
| | | if (detail.getExtract() == null || detail.getUser() == null)
|
| | | if (detail.getAlipayAccountValid() == null || detail.getUser() == null)
|
| | | throw new MsgMoneyDetailException(2, "消息信息不全");
|
| | | MsgMoneyDetail msg = msgMoneyDetailMapper.selectBySourceIdAndMsgType(detail.getExtract().getId(),
|
| | | MsgMoneyDetail msg = msgMoneyDetailMapper.selectBySourceIdAndMsgType(detail.getAlipayAccountValid().getId(),
|
| | | MsgTypeMoneyTypeEnum.extractValid);
|
| | | if (msg == null) {
|
| | | detail.setCreateTime(new Date());
|
| | |
| | | }
|
| | |
|
| | | } else if (detail.getMsgType() == MsgTypeMoneyTypeEnum.fanli) {
|
| | | if (detail.getMoney() == null || detail.getGoodsCount() == null || detail.getOrderCount() == null
|
| | | || detail.getOrderId() == null || detail.getBalance() == null)
|
| | | if (detail.getMoney() == null || detail.getGoodsCount() == null || detail.getOrderId() == null
|
| | | || detail.getBalance() == null)
|
| | | throw new MsgMoneyDetailException(2, "消息信息不全");
|
| | |
|
| | | detail.setCreateTime(new Date());
|
| | |
| | |
|
| | | @Override
|
| | | public List<MsgMoneyDetail> listMsgMoneyDetail(Long uid, int page) {
|
| | | return null;
|
| | | return msgMoneyDetailMapper.listByUid(uid, (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countMsgMoneyDetail(Long uid) {
|
| | | return 0;
|
| | | return msgMoneyDetailMapper.countByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void readMsgByUid(Long uid) {
|
| | | msgMoneyDetailMapper.setMsgReadByUid(uid);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | 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.util.Constant;
|
| | |
|
| | | @Service
|
| | | public class MsgOrderDetailServiceImpl implements MsgOrderDetailService {
|
| | |
| | |
|
| | | @Override
|
| | | public List<MsgOrderDetail> listMsgOrderDetail(Long uid, int page) {
|
| | | return null;
|
| | | return msgOrderDetailMapper.listByUid(uid, (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countMsgOrderDetail(Long uid) {
|
| | | return 0;
|
| | | return msgOrderDetailMapper.countByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void readMsgByUid(Long uid) {
|
| | | msgOrderDetailMapper.setMsgReadByUid(uid);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | 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) {
|
| | | getUserMsgUnReadNum(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addAccountMsgUnReadCount(Long uid, int count) {
|
| | | getUserMsgUnReadNum(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addMoneyMsgUnReadCount(Long uid, int count) {
|
| | | getUserMsgUnReadNum(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addInviteMsgUnReadCount(Long uid, int count) {
|
| | | getUserMsgUnReadNum(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addSystemMsgUnReadCount(Long uid, int count) {
|
| | | getUserMsgUnReadNum(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserMsgUnReadNum getReadStateByUid(Long uid) {
|
| | | return getUserMsgUnReadNum(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void readOrderMsg(Long uid) {
|
| | | msgOrderDetailService.readMsgByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void readAccountMsg(Long uid) {
|
| | | msgAccountDetailService.readMsgByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void readMoneyMsg(Long uid) {
|
| | | msgMoneyDetailService.readMsgByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void readInviteMsg(Long uid) {
|
| | | msgInviteDetailService.readMsgByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void readUserSystemMsg(Long uid) {
|
| | | userSystemMsgService.readMsgByUid(uid);
|
| | | }
|
| | |
|
| | | @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);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | 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.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);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | 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);
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public long countMsgAccountDetail(Long uid);
|
| | | |
| | | /**
|
| | | * 设置所有消息已读
|
| | | * |
| | | * @param uid
|
| | | */
|
| | | public void readMsgByUid(Long uid);
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public long countMsgInviteDetail(Long uid);
|
| | | |
| | | /**
|
| | | * 设置所有消息已读
|
| | | * |
| | | * @param uid
|
| | | */
|
| | | public void readMsgByUid(Long uid);
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public long countMsgMoneyDetail(Long uid);
|
| | | |
| | | /**
|
| | | * 设置所有消息已读
|
| | | * |
| | | * @param uid
|
| | | */
|
| | | public void readMsgByUid(Long uid);
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public long countMsgOrderDetail(Long uid);
|
| | | |
| | | /**
|
| | | * 设置所有消息已读
|
| | | * |
| | | * @param uid
|
| | | */
|
| | | public void readMsgByUid(Long uid);
|
| | | }
|
New file |
| | |
| | | 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);
|
| | | }
|
New file |
| | |
| | | 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);
|
| | |
|
| | | }
|
| | |
| | | public static MsgAccountDetail createBindingAccount(Long uid, int type) {
|
| | | String msg = "";
|
| | | if (type == TYPE_PHONE) {
|
| | | msg = "<red>恭喜你手机号绑定成功<red>";
|
| | | msg = "<highlight>恭喜你手机号绑定成功</highlight>";
|
| | | } else if (type == TYPE_TB) {
|
| | | msg = "<red>恭喜你淘宝绑定成功<red>";
|
| | | msg = "<highlight>恭喜你淘宝绑定成功</highlight>";
|
| | | } else if (type == TYPE_WX) {
|
| | | msg = "<red>恭喜你微信绑定成功<red>";
|
| | | msg = "<highlight>恭喜你微信绑定成功</highlight>";
|
| | | }
|
| | | if (StringUtil.isNullOrEmpty(msg))
|
| | | return null;
|
| | |
| | | if (extract == null || uid == null)
|
| | | return null;
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setBeiZhu(StringUtil.isNullOrEmpty(beiZhu) ? "无" : beiZhu);
|
| | | detail.setBeiZhu( beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setExtract(extract);
|
| | | detail.setMoney(extract.getMoney());
|
| | |
| | | if (extract == null || uid == null)
|
| | | return null;
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setBeiZhu(StringUtil.isNullOrEmpty(beiZhu) ? "无" : beiZhu);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setExtract(extract);
|
| | | detail.setMoney(extract.getMoney());
|
| | |
| | | if (extract == null || uid == null)
|
| | | return null;
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setBeiZhu(StringUtil.isNullOrEmpty(beiZhu) ? "无" : beiZhu);
|
| | | detail.setBeiZhu( beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setExtract(extract);
|
| | | detail.setMoney(extract.getMoney());
|
| | |
| | | return null;
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setAlipayAccountValid(valid);
|
| | | detail.setBeiZhu(StringUtil.isNullOrEmpty(beiZhu) ? "无" : beiZhu);
|
| | | detail.setBeiZhu( beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMoney(money);
|
| | | detail.setStateDesc(String
|
| | |
| | |
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setBalance(balance);
|
| | | detail.setBeiZhu(StringUtil.isNullOrEmpty(beiZhu) ? "无" : beiZhu);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setGoodsCount(goodsCount);
|
| | | detail.setMoney(money);
|
| | |
| | |
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setBalance(balance);
|
| | | detail.setBeiZhu(StringUtil.isNullOrEmpty(beiZhu) ? "无" : beiZhu);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setGoodsCount(goodsCount);
|
| | | detail.setMoney(money);
|
| | |
| | |
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setBalance(balance);
|
| | | detail.setBeiZhu(StringUtil.isNullOrEmpty(beiZhu) ? "无" : beiZhu);
|
| | | detail.setBeiZhu( beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setGoodsCount(goodsCount);
|
| | | detail.setMoney(money);
|
| | |
| | | * @return
|
| | | */
|
| | | public static MsgOrderDetail createFanLiOrder(Long uid, String orderId, int goodsCount, int orderState,
|
| | | BigDecimal payMoney, BigDecimal money, int state, String beiZhu) {
|
| | | BigDecimal payMoney, BigDecimal money, String beiZhu) {
|
| | | if (payMoney == null || money == null || uid == null)
|
| | | return null;
|
| | | MsgOrderDetail detail = new MsgOrderDetail();
|
| | |
| | | detail.setOrderId(orderId);
|
| | | detail.setPayMoney(payMoney);
|
| | | detail.setRead(false);
|
| | | detail.setState(state);
|
| | | detail.setState(orderState);
|
| | | detail.setType(MsgTypeOrderTypeEnum.fanli);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | |
| | | * @return
|
| | | */
|
| | | public static MsgOrderDetail createInviteOrder(Long uid, String orderId, int goodsCount, int orderState,
|
| | | BigDecimal payMoney, BigDecimal money, int state, String beiZhu) {
|
| | | BigDecimal payMoney, BigDecimal money, String beiZhu) {
|
| | | if (payMoney == null || money == null || uid == null)
|
| | | return null;
|
| | | MsgOrderDetail detail = new MsgOrderDetail();
|
| | |
| | | detail.setOrderId(orderId);
|
| | | detail.setPayMoney(payMoney);
|
| | | detail.setRead(false);
|
| | | detail.setState(state);
|
| | | detail.setState(orderState);
|
| | | detail.setType(MsgTypeOrderTypeEnum.invite);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | |
| | | * @return
|
| | | */
|
| | | public static MsgOrderDetail createShareOrder(Long uid, String orderId, int goodsCount, int orderState,
|
| | | BigDecimal payMoney, BigDecimal money, int state, String beiZhu) {
|
| | | BigDecimal payMoney, BigDecimal money, String beiZhu) {
|
| | | if (payMoney == null || money == null || uid == null)
|
| | | return null;
|
| | | MsgOrderDetail detail = new MsgOrderDetail();
|
| | |
| | | detail.setOrderId(orderId);
|
| | | detail.setPayMoney(payMoney);
|
| | | detail.setRead(false);
|
| | | detail.setState(state);
|
| | | detail.setState(orderState);
|
| | | detail.setType(MsgTypeOrderTypeEnum.share);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请奖金", "#888888"), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getBeiZhu(), "#000000"));
|
| | | contentList.add(
|
| | | new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(), "#000000"));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", "#888888"), contentList));
|
| | | return new UserMsgVO("http://ec-1255749512.file.myqcloud.com/resource/portrait.png", "订单消息",
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_order.png", "订单消息",
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getBeiZhu(), COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", "#888888"), contentList));
|
| | | return new UserMsgVO("http://ec-1255749512.file.myqcloud.com/resource/portrait.png", "提现",
|
| | | 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) {
|
| | | // 支付宝验证
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态说明", "#888888"), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getBeiZhu(), COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", "#888888"), contentList));
|
| | |
|
| | | return new UserMsgVO("http://ec-1255749512.file.myqcloud.com/resource/portrait.png", "提现账号验证",
|
| | | 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) {
|
| | | // 返利到账
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("账号余额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getBeiZhu(), COLOR_CONTENT));
|
| | | 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://ec-1255749512.file.myqcloud.com/resource/portrait.png", "返利到账",
|
| | | 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) {
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("账号余额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getBeiZhu(), COLOR_CONTENT));
|
| | | 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.add(Calendar.MONTH, -1);
|
| | | String date = ca.get(Calendar.YEAR) + "年" + (ca.get(Calendar.MONTH) + 1) + "月";
|
| | |
|
| | | return new UserMsgVO("http://ec-1255749512.file.myqcloud.com/resource/portrait.png",
|
| | | 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);
|
| | | }
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getBeiZhu() + "", COLOR_CONTENT));
|
| | | 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://ec-1255749512.file.myqcloud.com/resource/portrait.png", msg.getType().getDesc(),
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_account.png", msg.getType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | }
|
| | |
|
| | |
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("说明", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getBeiZhu() + "", COLOR_CONTENT));
|
| | | 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://ec-1255749512.file.myqcloud.com/resource/portrait.png", msg.getMsgType().getDesc(),
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite.png", msg.getMsgType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | }
|
| | |
|
| | |
| | | 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;
|
| | |
| | | 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
|
| | |
| | |
|
| | | if (item.optBoolean("free_shipment"))
|
| | | goods.setFreeShipment(1);
|
| | | |
| | | System.out.println(item.optString("material_lib_type"));
|
| | |
|
| | | return goods;
|
| | | }
|
| | |
| | |
|
| | | if (item.optBoolean("free_shipment"))
|
| | | goods.setFreeShipment(1);
|
| | |
|
| | | |
| | | if("1".equalsIgnoreCase(item.optString("material_lib_type")))
|
| | | TaoKeTest.count++;
|
| | | goodsList.add(goods);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | /**
|
| | | * 从淘宝链接中解析商品ID(高级接口)
|
| | | * |
| | | * @param link
|
| | | * @return
|
| | | */
|
| | |
| | | }
|
| | | 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;
|
| | |
|
| | | }
|
New file |
| | |
| | | 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 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;
|
| | | }
|
| | | }
|
New file |
| | |
| | | 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;
|
| | |
|
| | | public UserSystemMsgVO(Long id, String type, Boolean solved, String title, String content, String timeTag,
|
| | | String portrait, String createTime) {
|
| | | this.id = id;
|
| | | this.type = type;
|
| | | this.solved = solved;
|
| | | this.title = title;
|
| | | this.content = content;
|
| | | this.timeTag = timeTag;
|
| | | this.portrait = portrait;
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public UserSystemMsgVO() {
|
| | |
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | 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;
|
| | | }
|
| | |
|
| | | }
|