删除HistorySearchDao,删除ScanHistory
| | |
| | | package com.yeshi.fanli.controller;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.math.BigDecimal;
|
| | | import java.net.URLEncoder;
|
| | | import java.text.MessageFormat;
|
| | |
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.taobao.api.ApiException;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendDetails;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionDetail;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionGoods;
|
| | |
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleRankService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.ScanHistoryService;
|
| | | import com.yeshi.fanli.service.inter.user.ShamUserService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.AESUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private ClassRecommendGoodsService classRecommendGoodsService;
|
| | |
|
| | | @Resource
|
| | | private ScanHistoryService scanHistoryService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
| | |
|
| | | private static final String DOWNURL2 = "http://121.42.200.138/apk/fanliquan20180124.apk";
|
| | |
|
| | | @RequestMapping("classify")
|
| | | public String setClassify(long id, String key, String title, Model model) {
|
| | | String decodeKey = "";
|
| | | String decodeName = "";
|
| | | try {
|
| | | decodeKey = new String(key.getBytes("iso8859-1"), "UTF-8");
|
| | | decodeName = new String(title.getBytes("iso8859-1"), "UTF-8");
|
| | | } catch (UnsupportedEncodingException e) {
|
| | | decodeKey = key;
|
| | | decodeName = title;
|
| | | e.printStackTrace();
|
| | | }
|
| | | List<GoodsSecondClass> goodsSecondClassList = goodsSecondClassService.getGoodsSecondClassByGoodsClassId(id);
|
| | | List<TaoBaoGoodsBriefExtra> taoBaoGoodsBriefExtraList = scanHistoryService
|
| | | .getHotTaoBaoGoodsBriefExtras(decodeKey, 1);
|
| | | model.addAttribute("goodsSecondClassList", goodsSecondClassList);
|
| | | model.addAttribute("taoBaoGoodsBriefExtraList", taoBaoGoodsBriefExtraList);
|
| | | model.addAttribute("title", decodeName);
|
| | | return "classify";
|
| | | }
|
| | |
|
| | | @RequestMapping("coupon")
|
| | | public String conpon(Model model) {
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getHotGoods", method = RequestMethod.POST)
|
| | | public void getHotGoods(String key, int page, PrintWriter out) {
|
| | | List<TaoBaoGoodsBriefExtra> taoBaoGoodsBriefExtraList = scanHistoryService.getHotTaoBaoGoodsBriefExtras(key,
|
| | | page);
|
| | | if (taoBaoGoodsBriefExtraList.size() > 0) {
|
| | | out.append(JsonUtil.loadTrueResult(taoBaoGoodsBriefExtraList));
|
| | | } else {
|
| | | out.append(JsonUtil.loadFalseResult("没有更多商品"));
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping("share")
|
| | | public String getShare(Model model, String uid) {
|
| | |
| | | return data;
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "gethistorysearch", method = RequestMethod.POST)
|
| | | public void getHistorySearch(AcceptData acceptData, PrintWriter out) {
|
| | | String bid = getHistorySearchBid(acceptData);
|
| | | List<HistorySearch> historySearchList = historySearchService.getHistorySearch(bid);
|
| | | if (historySearchList == null || historySearchList.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", historySearchList.size());
|
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
|
| | | data.put("historySearchList", gson.toJson(historySearchList));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "clearhistorysearch", method = RequestMethod.POST)
|
| | | public void clearHistorySearch(AcceptData acceptData, PrintWriter out) {
|
| | | String bid = getHistorySearchBid(acceptData);
|
| | | long count = historySearchService.clearHistorySearch(bid);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "suggestsearch", method = RequestMethod.POST)
|
| | | public void getSugguestSearch(AcceptData acceptData, String kw, PrintWriter out) {
|
| | | List<String> list = TaoBaoUtil.getSuguestSearch(kw);
|
| | |
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.ScanHistoryService;
|
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsGroupService;
|
| | | import com.yeshi.fanli.util.AESUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | | @Resource
|
| | | private ScanHistoryService scanHistoryService;
|
| | |
|
| | | @Resource
|
| | | private TBPidService tbPidService;
|
| | |
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.bus.su.recommend.SuperRecommendSection;
|
| | | import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.entity.taobao.ScanHistory;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | |
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.ScanHistoryService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | | @Resource
|
| | | private ScanHistoryService scanHistoryService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService;
|
| | |
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | |
|
| | | final TaoBaoGoodsBrief tbb=tb;
|
| | | ThreadUtil.run(new Runnable() {
|
| | | public void run() {
|
| | | // 添加浏览记录
|
| | | ScanHistory sh = TaoBaoUtil.getScanHistory(tbb);
|
| | | sh.setDevice(acceptData.getDevice());
|
| | | sh.setSystem(businessSystemService.getBusinessSystem(acceptData.getPlatform(), acceptData.getPackages()));
|
| | | sh.setCreatetime(new Date());
|
| | | if (uid != null && !uid.equals("")) {
|
| | | sh.setUid(Long.parseLong(uid));
|
| | | }
|
| | | try {
|
| | | scanHistoryService.addScanHistory(sh);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult(2, "商品已下架"));
|
| | |
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
|
| | | import com.yeshi.fanli.service.inter.user.ScanHistoryService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private OrderService orderService;
|
| | |
|
| | | @Resource
|
| | | private ScanHistoryService scanHistoryService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
| | |
|
| | | /**
|
| | | *
|
| | | * 方法说明: 历史搜索
|
| | | * |
| | | * @author mawurui createTime 2018年4月25日 下午3:04:06
|
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "gethistorysearch", method = RequestMethod.POST)
|
| | | public void getHistorySearch(AcceptData acceptData, PrintWriter out) {
|
| | | String bid = getHistorySearchBid(acceptData);
|
| | | List<HistorySearch> historySearchList = historySearchService.getHistorySearch(bid);
|
| | | if (historySearchList == null || historySearchList.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult(XcxMiniControllerUtil.NODATA));
|
| | | return;
|
| | | }
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", historySearchList.size());
|
| | | Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
|
| | | data.put("historySearchList", gson.toJson(historySearchList));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * 方法说明: 清空历史搜索
|
| | | * |
| | | * @author mawurui createTime 2018年4月25日 下午3:04:23
|
| | | * @param acceptData
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "clearhistorysearch", method = RequestMethod.POST)
|
| | | public void clearHistorySearch(AcceptData acceptData, PrintWriter out) {
|
| | | String bid = getHistorySearchBid(acceptData);
|
| | | long count = historySearchService.clearHistorySearch(bid);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * 方法说明: 关键字提示建议搜索
|
| | | *
|
| | | * @author mawurui createTime 2018年4月25日 下午3:04:52
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.search.HistorySearch; |
| | | |
| | | public interface HistorySearchMapper extends BaseMapper<HistorySearch> { |
| | | |
| | | } |
| | |
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.persistence.Column;
|
| | | import javax.persistence.Entity;
|
| | | import javax.persistence.GeneratedValue;
|
| | | import javax.persistence.GenerationType;
|
| | | import javax.persistence.Id;
|
| | | import javax.persistence.Table;
|
| | |
|
| | | import org.hibernate.annotations.Type;
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | | @Entity
|
| | | @Table(name="`yeshi_ec_history_search`")
|
| | | @Table("`yeshi_ec_history_search`")
|
| | | public class HistorySearch {
|
| | | @Id
|
| | | @GeneratedValue(strategy=GenerationType.AUTO)
|
| | | @Column(name="id")
|
| | | private Long id;
|
| | | @Column(name="`name`")
|
| | | @Column(name="name")
|
| | | @Expose
|
| | | private String name;
|
| | | @Column(name="`businessId`")
|
| | | @Column(name="businessId")
|
| | | private String businessId;
|
| | | @Column(name="`state`",length=2)
|
| | | @Column(name="state")
|
| | | private int state;
|
| | | @Type(type="date")
|
| | | @Column(name="createtime")
|
| | | private Date createtime;
|
| | |
|
| | | public Long getId() {
|
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.HistorySearchMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.bus.search.HistorySearch"> |
| | | <id column="id" property="id" jdbcType="BIGINT" /> |
| | | <result column="name" property="name" jdbcType="VARCHAR" /> |
| | | <result column="businessId" property="businessId" jdbcType="VARCHAR" /> |
| | | <result column="state" property="state" jdbcType="VARCHAR" /> |
| | | <result column="createtime" property="createtime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">id,name,businessId,state,createtime</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from `yeshi_ec_history_search` where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | `yeshi_ec_history_search` where id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.search.HistorySearch" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | `yeshi_ec_history_search` (id,name,businessId,state,createtime) values |
| | | (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{businessId,jdbcType=VARCHAR},#{state,jdbcType=VARCHAR},#{createtime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.search.HistorySearch" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into `yeshi_ec_history_search` |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="name != null">name,</if> |
| | | <if test="businessId != null">businessId,</if> |
| | | <if test="state != null">state,</if> |
| | | <if test="createtime != null">createtime,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="name != null">#{name,jdbcType=VARCHAR},</if> |
| | | <if test="businessId != null">#{businessId,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">#{state,jdbcType=VARCHAR},</if> |
| | | <if test="createtime != null">#{createtime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.search.HistorySearch">update |
| | | `yeshi_ec_history_search` set name = |
| | | #{name,jdbcType=VARCHAR},businessId = |
| | | #{businessId,jdbcType=VARCHAR},state = |
| | | #{state,jdbcType=VARCHAR},createtime = |
| | | #{createtime,jdbcType=TIMESTAMP} where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.search.HistorySearch"> |
| | | update `yeshi_ec_history_search` |
| | | <set> |
| | | <if test="name != null">name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="businessId != null">businessId=#{businessId,jdbcType=VARCHAR},</if> |
| | | <if test="state != null">state=#{state,jdbcType=VARCHAR},</if> |
| | | <if test="createtime != null">createtime=#{createtime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | package com.yeshi.fanli.service.impl.user;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.hibernate.HibernateException;
|
| | | import org.hibernate.Query;
|
| | | import org.hibernate.SQLQuery;
|
| | | import org.hibernate.Session;
|
| | | import org.springframework.orm.hibernate4.HibernateCallback;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.user.HistorySearchDao;
|
| | | import com.yeshi.fanli.entity.admin.HistorySearchAdmin;
|
| | | import com.yeshi.fanli.dao.mybatis.HistorySearchMapper;
|
| | | import com.yeshi.fanli.entity.bus.search.HistorySearch;
|
| | | import com.yeshi.fanli.service.inter.user.HistorySearchService;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | |
|
| | | @Service
|
| | | public class HistorySearchServiceImpl implements HistorySearchService {
|
| | | |
| | |
|
| | | @Resource
|
| | | private HistorySearchDao historySearchDao;
|
| | | |
| | | |
| | | private HistorySearchMapper historySearchMapper;
|
| | |
|
| | | public void addHistorySearch(String searchKey, String bid) {
|
| | | HistorySearch historySearch = new HistorySearch();
|
| | | historySearch.setName(searchKey);
|
| | | historySearch.setBusinessId(bid);
|
| | | historySearch.setCreatetime(new Date());
|
| | | historySearch.setState(0);
|
| | | historySearchDao.create(historySearch);
|
| | | }
|
| | |
|
| | | public List<HistorySearch> getHistorySearch(String bid) {
|
| | | |
| | | List list = historySearchDao.list("select hs,MAX(hs.id) as maxid from HistorySearch hs where hs.state=0 and hs.businessId=? GROUP BY hs.name order by maxid desc ",0,10,new String[]{bid});
|
| | | List<HistorySearch> hlist= new ArrayList<HistorySearch>();
|
| | | for(int i = 0 ; i <list.size() ;i++ ){
|
| | | hlist.add((HistorySearch)((Object[])list.get(i))[0]);
|
| | | }
|
| | | return hlist;
|
| | | |
| | | }
|
| | |
|
| | | public int clearHistorySearch(final String bid) {
|
| | | return (Integer) historySearchDao.excute(new HibernateCallback() {
|
| | | public Object doInHibernate(Session session)
|
| | | throws HibernateException {
|
| | | int count;
|
| | | try {
|
| | | session.getTransaction().begin();
|
| | | Query query = session.createQuery("update HistorySearch hs set hs.state=1 where businessId=?");
|
| | | query.setString(0, bid);
|
| | | count = query.executeUpdate();
|
| | | session.getTransaction().commit();
|
| | | return count;
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | session.getTransaction().rollback();
|
| | | }
|
| | | return 0;
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | @SuppressWarnings("unchecked")
|
| | | public Map<String, Integer> getSearchTotalByDate(int days, Date date) {
|
| | |
|
| | | final Map<String, Integer> map =new HashMap<String, Integer>();
|
| | | long timestampms = date.getTime();
|
| | | final List<String> list = TimeUtil.getEmupDate(days,timestampms);
|
| | | for (String dataStr : list) {
|
| | | map.put(dataStr, 0);
|
| | | }
|
| | | return (Map<String, Integer>) historySearchDao.excute(new HibernateCallback<Map<String, Integer>>() {
|
| | |
|
| | | public Map<String, Integer> doInHibernate(Session session)
|
| | | throws HibernateException {
|
| | | StringBuffer sb = new StringBuffer();
|
| | | int ii=0;
|
| | | for (String day : list) {
|
| | | if(ii==0){
|
| | | sb.append("SELECT '"+day+"' AS t,IFNULL(SUM(a.s),0) FROM yeshi_ec_history_search_day a WHERE a.c<= '"+day+"' ");
|
| | | }else{
|
| | | sb.append("UNION ALL SELECT '"+day+"' AS t,IFNULL(SUM(a.s),0) FROM yeshi_ec_history_search_day a WHERE a.c<= '"+day+"' ");
|
| | | }
|
| | | ii++;
|
| | | }
|
| | | |
| | | SQLQuery sqlQuery = session.createSQLQuery(sb.toString());
|
| | | List<Object[]> list = sqlQuery.list();
|
| | | for (Object[] objArr : list) {
|
| | | map.put(String.valueOf(objArr[0]),((BigDecimal)objArr[1]).intValue());
|
| | | }
|
| | | return map;
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | @SuppressWarnings("unchecked")
|
| | | public Map<String, Integer> getSearchTotalByMonth(int months, Date date) {
|
| | | final List<String> monthList = Utils.getDateMonthList(months,date);
|
| | | final Map<String, Integer> map =new HashMap<String, Integer>();
|
| | | for (String monthStr : monthList) {
|
| | | map.put(monthStr, 0);
|
| | | }
|
| | | return (Map<String, Integer>) historySearchDao.excute(new HibernateCallback<Map<String, Integer>>() {
|
| | |
|
| | | public Map<String, Integer> doInHibernate(Session session)
|
| | | throws HibernateException {
|
| | | |
| | | StringBuffer sb = new StringBuffer();
|
| | | int ii=0;
|
| | | for (String month : monthList) {
|
| | | if(ii==0){
|
| | | sb.append("SELECT '"+month+"' AS t,IFNULL(SUM(a.s),0) FROM yeshi_ec_history_search_month a WHERE a.months<= '"+month+"' ");
|
| | | }else{
|
| | | sb.append("UNION ALL SELECT '"+month+"' AS t,IFNULL(SUM(a.s),0) FROM yeshi_ec_history_search_month a WHERE a.months<= '"+month+"' ");
|
| | | }
|
| | | ii++;
|
| | | }
|
| | | |
| | | SQLQuery sqlQuery = session.createSQLQuery(sb.toString());
|
| | | List<Object[]> list = sqlQuery.list();
|
| | | for (Object[] objArr : list) {
|
| | | map.put((String) objArr[0],((BigDecimal)objArr[1]).intValue());
|
| | | }
|
| | | return map;
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | @SuppressWarnings("unchecked")
|
| | | public List<HistorySearchAdmin> getSearchRankByDate(final int days, final Date date) {
|
| | | |
| | | return (List<HistorySearchAdmin>) historySearchDao.excute(new HibernateCallback<List<HistorySearchAdmin>>() {
|
| | |
|
| | | public List<HistorySearchAdmin> doInHibernate(Session session)
|
| | | throws HibernateException {
|
| | | |
| | | SQLQuery query = session.createSQLQuery("SELECT `name`,COUNT(`name`) `sum` FROM yeshi_ec_history_search WHERE createtime >= DATE_SUB(?,INTERVAL ? DAY) AND createtime < ? GROUP BY `name` ORDER BY `sum` DESC LIMIT 0,20");
|
| | | query.setParameter(0, date);
|
| | | query.setParameter(1, days);
|
| | | query.setParameter(2, date);
|
| | | List<HistorySearchAdmin> list = query.list();
|
| | | return list;
|
| | | }
|
| | | });
|
| | | historySearchMapper.insertSelective(historySearch);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.user;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import com.yeshi.fanli.entity.admin.HistorySearchAdmin;
|
| | | import com.yeshi.fanli.entity.bus.search.HistorySearch;
|
| | |
|
| | | public interface HistorySearchService {
|
| | |
|
| | | public void addHistorySearch(String searchKey, String bid);
|
| | |
|
| | | public List<HistorySearch> getHistorySearch(String bid);
|
| | |
|
| | | public int clearHistorySearch(String bid);
|
| | |
|
| | | public Map<String, Integer> getSearchTotalByDate(int days, Date date);
|
| | |
|
| | | public Map<String, Integer> getSearchTotalByMonth(int months, Date date);
|
| | |
|
| | | public List<HistorySearchAdmin> getSearchRankByDate(int days, Date date);
|
| | |
|
| | | }
|
| | |
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.common.ImageInfo;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.taobao.ScanHistory;
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoCoupon;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | |
| | | return presult.getTaoBaoGoodsBriefs().get(0);
|
| | | } else
|
| | | return null;
|
| | | }
|
| | |
|
| | | public static TaoBaoGoodsBrief getTaoBaoGoodsBrief(ScanHistory sh) {
|
| | | TaoBaoGoodsBrief tb = new TaoBaoGoodsBrief();
|
| | | Field[] fields = tb.getClass().getDeclaredFields();
|
| | | Field[] shFields = sh.getClass().getDeclaredFields();
|
| | | for (int i = 0; i < fields.length; i++) {
|
| | | Field field = fields[i];
|
| | | field.setAccessible(true);
|
| | | try {
|
| | | for (Field target : shFields) {
|
| | | target.setAccessible(true);
|
| | | if (target.getName().equalsIgnoreCase(field.getName())) {
|
| | | field.set(tb, target.get(sh));
|
| | | break;
|
| | | }
|
| | | }
|
| | | } catch (IllegalArgumentException e) {
|
| | | e.printStackTrace();
|
| | | } catch (IllegalAccessException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | return tb;
|
| | | }
|
| | |
|
| | | public static ScanHistory getScanHistory(TaoBaoGoodsBrief tb) {
|
| | | ScanHistory sh = new ScanHistory();
|
| | | Field[] fields = tb.getClass().getDeclaredFields();
|
| | | Field[] shFields = sh.getClass().getDeclaredFields();
|
| | | for (int i = 0; i < fields.length; i++) {
|
| | | Field field = fields[i];
|
| | | field.setAccessible(true);
|
| | | try {
|
| | | for (Field target : shFields) {
|
| | | target.setAccessible(true);
|
| | | if (target.getName().equalsIgnoreCase(field.getName())) {
|
| | | target.set(sh, field.get(tb));
|
| | | break;
|
| | | }
|
| | | }
|
| | | } catch (IllegalArgumentException e) {
|
| | | } catch (IllegalAccessException e) {
|
| | | }
|
| | | }
|
| | |
|
| | | return sh;
|
| | | }
|
| | |
|
| | | public static List<String> getSuguestSearch(String key) {
|