| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.hibernate.HibernateException;
|
| | | import org.hibernate.Session;
|
| | | import org.springframework.orm.hibernate4.HibernateCallback;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.config.SystemZnxDao;
|
| | | import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
|
| | | import com.yeshi.fanli.dao.user.UserInfoDao;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountMessage;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.system.SystemZnx;
|
| | | import com.yeshi.fanli.service.inter.user.AccountMessageService;
|
| | | import com.yeshi.fanli.service.inter.user.SystemZnxService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | @Service
|
| | |
| | | @Resource
|
| | | private AccountMessageMapper accountMessageMapper;
|
| | | @Resource
|
| | | private UserInfoDao userInfoDao;
|
| | | private UserInfoService userInfoService;
|
| | | |
| | | @Resource
|
| | | private SystemZnxDao systemZnxDao;
|
| | | private SystemZnxService systemZnxService;
|
| | |
|
| | | @Override
|
| | | public List<AccountMessage> findAccountMessageList(long uid, int page) {
|
| | |
| | | accountMessageMapper.insertSelective(accountMessage);
|
| | | }
|
| | |
|
| | | @SuppressWarnings("unchecked")
|
| | | @Override
|
| | | public void syncSystemZnx(long uid) {
|
| | | UserInfo userInfo = userInfoDao.find(UserInfo.class, uid);
|
| | | UserInfo userInfo = userInfoService.selectByPKey(uid);
|
| | | if (userInfo == null)
|
| | | return;
|
| | | List<SystemZnx> list = (List<SystemZnx>) systemZnxDao.excute(new HibernateCallback<List<SystemZnx>>() {
|
| | | @SuppressWarnings("unchecked")
|
| | | @Override
|
| | | public List<SystemZnx> doInHibernate(Session session) throws HibernateException {
|
| | | List result = session
|
| | | .createSQLQuery(
|
| | | "SELECT sm.* FROM `yeshi_ec_system_msg` sm LEFT JOIN (SELECT * FROM `yeshi_ec_account_message` a WHERE a.`uid`=? AND a.`system_msg_id` IS NOT NULL) s ON s.`system_msg_id`=sm.`id` WHERE s.`system_msg_id` IS NULL and sm.createTime>="
|
| | | + userInfo.getCreatetime())
|
| | | .addEntity(SystemZnx.class).setParameter(0, uid).list();
|
| | | if (result != null) {
|
| | | List<SystemZnx> list = (List<SystemZnx>) result;
|
| | | return list;
|
| | | }
|
| | | return null;
|
| | | }
|
| | | });
|
| | | |
| | | List<SystemZnx> list = systemZnxService.listbyUidAndCreateTime(uid, userInfo.getCreatetime());
|
| | |
|
| | | if (list != null)
|
| | | for (SystemZnx systemZnx : list) {
|
| | | AccountMessage accountMessage = new AccountMessage();
|