fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java
@@ -472,7 +472,7 @@ volist.add(vo); } Long time = userInfoService.selectByPKey(uid).getCreatetime(); Long time = System.currentTimeMillis();//userInfoService.selectByPKey(uid).getCreatetime(); if (time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd")) count++;// 计算欢迎语的数量 fanli/src/main/java/com/yeshi/fanli/dao/hongbao/HongBaoManageDao.java
File was deleted fanli/src/main/java/com/yeshi/fanli/dao/mybatis/AccountMessageMapper.java
@@ -1,5 +1,9 @@ package com.yeshi.fanli.dao.mybatis; import java.util.List; import org.apache.ibatis.annotations.Param; import com.yeshi.fanli.entity.bus.user.AccountMessage; public interface AccountMessageMapper { @@ -15,4 +19,23 @@ int updateByPrimaryKeySelective(AccountMessage record); int updateByPrimaryKey(AccountMessage record); /** * 通过用户ID查询消息(id倒叙排列) * * @param uid * @param start * @param count * @return */ List<AccountMessage> listByUidOrderByIdDesc(@Param("uid")Long uid, @Param("start")long start, @Param("count")int count); /** * 根据用户ID获取是否已经打开的消息数量 * @param uid * @param open * @return */ long countByUidAndOpen(@Param("uid")Long uid,@Param("open")Boolean open); } fanli/src/main/java/com/yeshi/fanli/dao/mybatis/HongBaoManageMapper.java
@@ -1,5 +1,7 @@ package com.yeshi.fanli.dao.mybatis; import java.util.List; import org.apache.ibatis.annotations.Param; import com.yeshi.fanli.entity.bus.user.HongBaoManage; @@ -27,5 +29,12 @@ * @param timeStamp * @return */ HongBaoManage selectByKeyAndMaxValidTime(@Param("key")String key,@Param("timeStamp") long timeStamp); HongBaoManage selectByKeyAndMaxValidTime(@Param("key") String key, @Param("timeStamp") long timeStamp); /** * 获取所有的配置 * * @return */ List<HongBaoManage> listAll(); } fanli/src/main/java/com/yeshi/fanli/dao/user/AccountMessageDao.java
File was deleted fanli/src/main/java/com/yeshi/fanli/dao/user/BindingAccountDao.java
File was deleted fanli/src/main/java/com/yeshi/fanli/mapping/AccountMessageMapper.xml
@@ -19,8 +19,33 @@ <include refid="Base_Column_List" /> from yeshi_ec_account_message where id = #{id,jdbcType=BIGINT} </select> <select id="listByUidOrderByIdDesc" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from yeshi_ec_account_message where uid = #{uid,jdbcType=BIGINT} order by id desc limit #{start},#{count} </select> <select id="countByUidAndOpen" resultType="java.lang.Long"> select count(id) from yeshi_ec_account_message where uid = #{uid,jdbcType=BIGINT} <if test="open!=null"> <if test="open==true"> and isOpen=1 </if> <if test="open==false"> and isOpen=0 </if> </if> </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_account_message where id = #{id,jdbcType=BIGINT}</delete> yeshi_ec_account_message where id = #{id,jdbcType=BIGINT} </delete> <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.AccountMessage" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_account_message fanli/src/main/java/com/yeshi/fanli/mapping/HongBaoManageMapper.xml
@@ -25,6 +25,11 @@ desc limit 1 </select> <select id="listAll" resultMap="BaseResultMap"> select <include refid="Base_Column_List" /> from yeshi_ec_hongbao_manage </select> <select id="selectByKeyAndMaxValidTime" resultMap="BaseResultMap"> select fanli/src/main/java/com/yeshi/fanli/service/impl/goods/RecommendUserGoodsServiceImpl.java
@@ -39,7 +39,8 @@ RecommendUserGoods goods = new RecommendUserGoods(); goods.setCreateTime(new Date()); goods.setRecommendDesc(recommendDesc); goods.setUser(new UserInfo(uid)); if (uid != null) goods.setUser(new UserInfo(uid)); goods.setDevice(device); recommendUserGoodsMapper.insertSelective(goods); for (CommonGoods commonGoods : goodsList) @@ -75,7 +76,7 @@ public RecommendUserGoods getLatestRecommendUserGoods(Long uid) { return recommendUserGoodsMapper.getLatestRecommendUserGoods(uid); } @Override public RecommendUserGoods getLatestRecommendUserGoodsByDevice(String device) { return recommendUserGoodsMapper.getLatestRecommendUserGoodsByDevice(device); @@ -85,7 +86,7 @@ public List<RecommendUserGoods> listRecommendGoodsByDevice(String device, int page, int pageSize) { return recommendUserGoodsMapper.listRecommendGoodsByDevice(device, (page - 1) * pageSize, pageSize); } @Override public long countRecommendGoodsByDevice(String device) { return recommendUserGoodsMapper.countRecommendGoodsByDevice(device); fanli/src/main/java/com/yeshi/fanli/service/impl/hongbao/HongBaoManageServiceImpl.java
@@ -1,7 +1,6 @@ package com.yeshi.fanli.service.impl.hongbao; import java.math.BigDecimal; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -9,14 +8,9 @@ import javax.annotation.Resource; import javax.transaction.Transactional; import org.hibernate.HibernateException; import org.hibernate.Query; import org.hibernate.Session; import org.springframework.cache.annotation.Cacheable; import org.springframework.orm.hibernate4.HibernateCallback; import org.springframework.stereotype.Service; import com.yeshi.fanli.dao.hongbao.HongBaoManageDao; import com.yeshi.fanli.dao.mybatis.HongBaoManageMapper; import com.yeshi.fanli.entity.bus.user.HongBaoManage; import com.yeshi.fanli.log.LogHelper; @@ -26,41 +20,26 @@ public class HongBaoManageServiceImpl implements HongBaoManageService { @Resource private HongBaoManageDao hongBaoManageDao; @Resource private HongBaoManageMapper hongBaoManageMapper; public List<HongBaoManage> getHongBaoManage() { List<HongBaoManage> list = hongBaoManageDao.list("from HongBaoManage"); return list; } @Transactional public void update(List<HongBaoManage> hongBaoManageList) { for (HongBaoManage hongBaoManage : hongBaoManageList) { hongBaoManageDao.update(hongBaoManage); hongBaoManageMapper.updateByPrimaryKeySelective(hongBaoManage); } } @Cacheable(value = "homeBaoManage", key = "#p0") public String get(final String key) { return (String) hongBaoManageDao.excute(new HibernateCallback<String>() { public String doInHibernate(Session session) throws HibernateException { Query query = session.createQuery("from HongBaoManage hbm where hbm.key = ? "); query.setParameter(0, key); List<HongBaoManage> list = query.list(); if (list.size() == 0) { return null; } return list.get(0).getValue(); } }); HongBaoManage hongBaoManage = hongBaoManageMapper.selectByKey(key); if (hongBaoManage != null) hongBaoManage.getValue(); return null; } @Cacheable(value = "homeBaoManage", key = "'convertMap'") public Map<String, String> convertMap() { List<HongBaoManage> list = hongBaoManageDao.list("from HongBaoManage"); List<HongBaoManage> list = hongBaoManageMapper.listAll(); Map<String, String> map = new HashMap<String, String>(); for (HongBaoManage hongBaoManage : list) { map.put(hongBaoManage.getKey(), hongBaoManage.getValue()); fanli/src/main/java/com/yeshi/fanli/service/impl/user/AccountMessageServiceImpl.java
@@ -1,6 +1,5 @@ package com.yeshi.fanli.service.impl.user; import java.io.Serializable; import java.util.List; import javax.annotation.Resource; @@ -11,7 +10,7 @@ import org.springframework.stereotype.Service; import com.yeshi.fanli.dao.config.SystemZnxDao; import com.yeshi.fanli.dao.user.AccountMessageDao; 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; @@ -23,47 +22,43 @@ public class AccountMessageServiceImpl implements AccountMessageService { @Resource private AccountMessageDao dao; private AccountMessageMapper accountMessageMapper; @Resource private UserInfoDao userInfoDao; @Resource private SystemZnxDao systemZnxDao; @Resource private AccountMessageService accountMessageService; @Override public List<AccountMessage> findAccountMessageList(long uid, int page) { return dao.list("from AccountMessage am where am.userInfo.id=? order by id desc", (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, new Serializable[] { uid }); return accountMessageMapper.listByUidOrderByIdDesc(uid, (page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE); } @Override public int getCount(long uid) { return (int) dao.getCount("select count(*) from AccountMessage am where am.userInfo.id=?", new Serializable[] { uid }); return (int) accountMessageMapper.countByUidAndOpen(uid, null); } @Override public void open(long id) { AccountMessage find = dao.find(AccountMessage.class, id); AccountMessage find = accountMessageMapper.selectByPrimaryKey(id); if (find != null) { find.setIsOpen(true); dao.update(find); AccountMessage update = new AccountMessage(); update.setId(id); update.setIsOpen(true); accountMessageMapper.updateByPrimaryKeySelective(update); } } @Override public int getCanOpenCount(long uid) { return (int) dao.getCount("select count(*) from AccountMessage am where am.userInfo.id=? and am.isOpen=0", new Serializable[] { uid }); return (int) accountMessageMapper.countByUidAndOpen(uid, false); } @Override public void save(AccountMessage accountMessage) { if (accountMessage != null) dao.save(accountMessage); accountMessageMapper.insertSelective(accountMessage); } @SuppressWarnings("unchecked") @@ -97,7 +92,7 @@ accountMessage.setIsOpen(false); accountMessage.setUserInfo(new UserInfo(uid)); accountMessage.setSystemMsgId(systemZnx.getId()); accountMessageService.save(accountMessage); save(accountMessage); } } fanli/src/main/java/com/yeshi/fanli/service/inter/hongbao/HongBaoManageService.java
@@ -10,8 +10,6 @@ public interface HongBaoManageService { public List<HongBaoManage> getHongBaoManage(); @CacheEvict(value = "homeBaoManage", allEntries = true) public void update(List<HongBaoManage> hongBaoManageList);