admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package com.yeshi.fanli.lijin.service.impl;
 
import com.yeshi.fanli.entity.bus.msg.MsgExtra;
import com.yeshi.fanli.exception.msg.MsgLijinVIPDetailException;
import com.yeshi.fanli.lijin.dao.MsgLijinVIPDetailMapper;
import com.yeshi.fanli.lijin.entity.MsgLijinVIPDetail;
import com.yeshi.fanli.lijin.service.MsgLijinVIPService;
import com.yeshi.fanli.service.inter.msg.MsgExtraService;
import com.yeshi.fanli.service.inter.msg.MsgOverViewsService;
import com.yeshi.fanli.util.factory.msg.MsgOverViewsFactory;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
 
@Service
public class MsgLijinVIPServiceImpl implements MsgLijinVIPService {
    @Resource
    private MsgLijinVIPDetailMapper msgLijinVIPDetailMapper;
    @Resource
    private MsgOverViewsService msgOverViewsService;
    @Resource
    private MsgExtraService msgExtraService;
 
 
    @Override
    public void addMsgLijinVIPDetail(MsgLijinVIPDetail detail, boolean needNotify) throws MsgLijinVIPDetailException {
        if (detail.getType() == null || detail.getType() == null) {
            throw new MsgLijinVIPDetailException(1, "参数不完整");
        }
        detail.setCreateTime(new Date());
        detail.setUpdateTime(new Date());
        detail.setRead(false);
        msgLijinVIPDetailMapper.insertSelective(detail);
        //加入消息索引
        msgOverViewsService.save(MsgOverViewsFactory.create(detail));
        // 消息内容
        msgExtraService.addMsgExtra(detail.getId(), detail.getExtraInfo(), MsgExtra.MSG_TYPE_LIJIN_VIP);
    }
 
    @Override
    public List<MsgLijinVIPDetail> listDetail(List<Long> ids) {
        return msgLijinVIPDetailMapper.listByPrimaryKeys(ids);
    }
}