From 69bee82b81626b82b7f39f0e459e4f56b1699b51 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期三, 13 三月 2019 12:02:16 +0800 Subject: [PATCH] 正式数据库修改 --- fanli/src/main/java/com/yeshi/fanli/controller/ClientJspController.java | 68 +++++++++++----------------------- 1 files changed, 22 insertions(+), 46 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/ClientJspController.java b/fanli/src/main/java/com/yeshi/fanli/controller/ClientJspController.java index ed84edc..60ca6b8 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/ClientJspController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/ClientJspController.java @@ -21,6 +21,10 @@ import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.yeshi.utils.HttpUtil; +import org.yeshi.utils.JsonUtil; +import org.yeshi.utils.NumberUtil; +import org.yeshi.utils.wx.WXUtil; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -31,9 +35,7 @@ import com.yeshi.fanli.entity.bus.recommend.RecommendSectionDetail; import com.yeshi.fanli.entity.bus.recommend.RecommendSectionGoods; import com.yeshi.fanli.entity.bus.share.UserShareGoodsHistory; -import com.yeshi.fanli.entity.bus.user.HongBao; import com.yeshi.fanli.entity.bus.user.InviteUser; -import com.yeshi.fanli.entity.bus.user.ThreeSaleRank; import com.yeshi.fanli.entity.bus.user.UserInfo; import com.yeshi.fanli.entity.system.CustomerContent; import com.yeshi.fanli.entity.system.CustomerName; @@ -64,8 +66,6 @@ import com.yeshi.fanli.service.inter.goods.TaoBaoCouponService; import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService; import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService; -import com.yeshi.fanli.service.inter.hongbao.HongBaoMessageService; -import com.yeshi.fanli.service.inter.hongbao.HongBaoService; import com.yeshi.fanli.service.inter.hongbao.ThreeSaleRankService; import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce; import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService; @@ -82,10 +82,6 @@ import com.yeshi.fanli.util.taobao.TaoBaoUtil; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; import com.yeshi.fanli.util.wx.WXLoginUtil; -import org.yeshi.utils.HttpUtil; -import org.yeshi.utils.JsonUtil; -import org.yeshi.utils.NumberUtil; -import org.yeshi.utils.wx.WXUtil; import net.sf.json.JSONArray; import net.sf.json.JSONObject; @@ -140,13 +136,7 @@ private ThreeSaleSerivce threeSaleSerivce; @Resource - private HongBaoService hongBaoService; - - @Resource private UserInfoService userInfoService; - - @Resource - private HongBaoMessageService hongBaoMessageService; @Resource private ThreeSaleRankService threeSaleRankService; @@ -204,7 +194,7 @@ @RequestMapping("coupon") public String conpon(Model model) { List<TaoBaoCoupon> couponList = taoBaoCouponService.getTaoBaoCouponList("", 1); - String proportion = hongBaoManageService.get(Constant.HONGBAO_GOODS_PROPORTION); + BigDecimal proportion = hongBaoManageService.getFanLiRate(); String jsonArr = Utils.imgListSize(JsonUtil.getApiCommonGson().toJson(couponList)); JSONArray jsonArray = JSONArray.fromObject(jsonArr); List<TaoBaoCoupon> collection = (List<TaoBaoCoupon>) JSONArray.toCollection(jsonArray, TaoBaoCoupon.class); @@ -213,30 +203,23 @@ return "coupon"; } - @RequestMapping("findThreeSaleInfo") - public void findThreeSaleInfo(long id, PrintWriter out) { - int count = threeSaleSerivce.findInviteCount(id); - double money = hongBaoService.findThreeSaleMoney(id); - List<ThreeSaleRank> list = threeSaleRankService.rank(5); - JSONObject data = new JSONObject(); - data.put("count", count); - data.put("money", money); - data.put("list", list); - out.print(JsonUtil.loadTrueResult(data)); - } - @RequestMapping("findThreeFriendsCount") - public void findThreeFriendsCount(long id, PrintWriter out) { + public void findThreeFriendsCount(long id, String callback, PrintWriter out) { int count1 = userInfoService.findFriendsCount(id, 1); int count2 = userInfoService.findFriendsCount(id, 2); JSONObject data = new JSONObject(); data.put("count1", count1); data.put("count2", count2); - out.print(JsonUtil.loadTrueResult(data)); + + if (!StringUtil.isNullOrEmpty(callback)) { + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); + } else { + out.print(JsonUtil.loadTrueResult(data)); + } } @RequestMapping("findThreeFriends") - public void findThreeFriends(long id, int type, int page, PrintWriter out) { + public void findThreeFriends(long id, int type, int page, String callback, PrintWriter out) { int pageSize = 30; List<InviteUser> list = userInfoService.getFriendsList(id, type, page, pageSize); JSONArray array = new JSONArray(); @@ -251,22 +234,17 @@ JSONObject data = new JSONObject(); data.put("list", array); data.put("pages", count % pageSize == 0 ? count / pageSize : count / pageSize + 1); - out.print(JsonUtil.loadTrueResult(data)); - } - - @RequestMapping("findThreeSales") - public void findThreeSales(long id, PrintWriter out) { - List<HongBao> list = hongBaoService.findThreeSaleHongBao(id); - String json = JsonUtil.getApiCommonGson().toJson(list); - JSONObject data = new JSONObject(); - data.put("list", json); - out.print(JsonUtil.loadTrueResult(data)); + if (!StringUtil.isNullOrEmpty(callback)) { + out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data))); + } else { + out.print(JsonUtil.loadTrueResult(data)); + } } @RequestMapping(value = "getConpon", method = RequestMethod.POST) public void getConpon(int page, PrintWriter out) { List<TaoBaoCoupon> taoBaoCouponList = taoBaoCouponService.getTaoBaoCouponList("", page); - String proportion = hongBaoManageService.get(Constant.HONGBAO_GOODS_PROPORTION); + BigDecimal proportion = hongBaoManageService.getFanLiRate(); JSONObject data = new JSONObject(); data.put("taoBaoCouponList", Utils.imgListSize(JsonUtil.getApiCommonGson().toJson(taoBaoCouponList))); data.put("proportion", proportion); @@ -607,12 +585,10 @@ } JSONObject data = new JSONObject(); List<TaoBaoGoodsBriefExtra> list = new ArrayList<TaoBaoGoodsBriefExtra>(); - Map<String, String> map = hongBaoManageService.convertMap(); - String proportion = map.get("hongbao_goods_proportion"); - String fcRate = map.get("hongbao_fc_ratio"); + BigDecimal proportion = hongBaoManageService.getFanLiRate(); for (RecommendSectionGoods recommendSectionGoods : recommendSectionGoodsList) { - list.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(recommendSectionGoods.getTaoBaoGoodsBrief(), proportion, - fcRate, "")); + list.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(recommendSectionGoods.getTaoBaoGoodsBrief(), + proportion.toString(), "")); } Gson gson = JsonUtil.getApiCommonGson(); -- Gitblit v1.8.0