| | |
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | |
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | import com.yeshi.fanli.service.inter.push.PushRecordService;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.SystemZnxService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.IOSPushFactory;
|
| | |
|
| | | import org.yeshi.utils.HttpUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | /**
|
| | | * 商品推送 -(新后台)
|
| | | * |
| | | * @param uId
|
| | | * -用户ID 可为空
|
| | | * @param url
|
| | | * -商品链接
|
| | | * @param title
|
| | | * -推送标题
|
| | | * @param content
|
| | | * -推送内容
|
| | | * @param out
|
| | | * @throws Exception
|
| | | */
|
| | | @RequestMapping(value = "newPushGoodsAll")
|
| | | public void newPushGoodsAll(String callback, Long uid, String url, String title, String content, PrintWriter out) throws Exception {
|
| | | |
| | | String auctionId = null;
|
| | | if (!StringUtil.isNullOrEmpty(url) && url.contains("id=")) {
|
| | | String[] sts = url.split("\\?")[1].split("&");
|
| | | for (String st : sts)
|
| | | if (st.contains("id=")) {
|
| | | auctionId = st.replace("id=", "");
|
| | | }
|
| | | }
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(auctionId)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("提取商品ID失败"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONObject json = IOSPushFactory.createGoodsPush(Long.parseLong(auctionId), title, content);
|
| | | if (json.toString().getBytes().length > 256) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("标题或内容过长,请删减后再试"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | pushService.pushGoods(uid, url, title, content);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("推送失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 网页推送 -(新后台)
|
| | | * |
| | | * @param url
|
| | | * @param title
|
| | | * @param content
|
| | | * @param out
|
| | | * @throws Exception
|
| | | */
|
| | | @RequestMapping(value = "newPushUrlAll")
|
| | | public void newPushUrlAll(String callback, String url, String title, String content, PrintWriter out) {
|
| | | |
| | | if (StringUtil.isNullOrEmpty(url) || StringUtil.isNullOrEmpty(title) || StringUtil.isNullOrEmpty(content)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请填写链接,标题与内容"));
|
| | | return;
|
| | | }
|
| | |
|
| | | JSONObject json = IOSPushFactory.createURLPush(HttpUtil.getShortLink(url), title, content);
|
| | | if (json.toString().getBytes().length > 256) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("标题或内容过长,请删减后再试"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | pushService.pushUrl(null, url, title, content);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
|
| | | } catch (PushException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("推送失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * |
| | | * 方法说明: 站内信推送 -(新后台)
|
| | | * |
| | | * @param uId
|
| | | * @param title
|
| | | * @param content
|
| | | * @throws Exception
|
| | | */
|
| | | @RequestMapping(value = "newPushFanZNX")
|
| | | public void newPushFanZNX(String callback, Long uid, String title, String content, PrintWriter out) {
|
| | | |
| | | if (StringUtil.isNullOrEmpty(title) || StringUtil.isNullOrEmpty(content)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请填写标题与内容"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | pushService.pushZNX(uid, title, content);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
|
| | | } catch (PushException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("推送失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.push.PushRecordService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 推荐记录 -(新后台)
|
| | | * @param callback
|
| | | * @param key
|
| | | * @param type
|
| | | * @param pageIndex
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getNewPushRecordList")
|
| | | public void getNewPushRecordList(String callback, String key, Integer type, Integer pageIndex, PrintWriter out){
|
| | | try {
|
| | | |
| | | if (pageIndex == null || pageIndex < 0){
|
| | | pageIndex = 1;
|
| | | }
|
| | | |
| | | if (type == null) {
|
| | | type = 0;
|
| | | }
|
| | | |
| | | List<PushRecord> list = pushRecordService.getPushRecordList(key, type, pageIndex);
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无更多数据"));
|
| | | return;
|
| | | }
|
| | | |
| | | int count = pushRecordService.getCount(key, type, pageIndex);
|
| | | PageEntity pe = new PageEntity(pageIndex, Constant.PAGE_SIZE, count);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", list);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | }
|
| | | |
| | | |
| | | }
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 上传图片jsonp
|
| | | * @param file |
| | | * @param out |
| | | */
|
| | | @RequestNoLogin()
|
| | | @RequestMapping(value = "uploadPicture")
|
| | | public void uploadPicture(@RequestParam("file") CommonsMultipartFile file, Long uid, |
| | | HttpServletResponse response, PrintWriter out) {
|
| | | |
| | | response.setHeader("Access-Control-Allow-Origin", "*");
|
| | | response.setHeader("Access-Control-Allow-Methods", "*");
|
| | |
|
| | | AdminUser admin = adminUserService.selectByPrimaryKey(uid);
|
| | | if (admin == null) {
|
| | | out.print(JsonUtil.loadFalseResult("当前账户验证失败"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (file == null) {
|
| | | out.print(JsonUtil.loadFalseResult("上传文件为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | InputStream inputStream = file.getInputStream();
|
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | // 上传文件相对位置
|
| | | String fileUrl=UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | |
| | | String uploadPath = COSManager.getInstance().uploadFile(inputStream, fileUrl).getUrl();
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(uploadPath));
|
| | | |
| | | } catch (IOException e) {
|
| | | out.print(JsonUtil.loadFalseResult("上传图片失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.controller.admin.homemodule;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SuperHomeNavbar;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.HomeNavbarService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SuperHomeNavbarService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/navbar")
|
| | | public class HomeNavbarAdminController {
|
| | |
|
| | | @Resource
|
| | | private SystemService systemService;
|
| | | |
| | | @Resource
|
| | | private HomeNavbarService homeNavbarService;
|
| | | |
| | | @Resource
|
| | | private SuperHomeNavbarService superHomeNavbarService;
|
| | | |
| | | |
| | | |
| | | /**
|
| | | * 新增
|
| | | * @param callback
|
| | | * @param special
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveAdd")
|
| | | public void saveAdd(String callback, HomeNavbar homeNavbar, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | |
| | | String name = homeNavbar.getName();
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("导航名称不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | homeNavbar.setCreatetime(new Date());
|
| | | homeNavbar.setUpdatetime(new Date());
|
| | | |
| | | int maxOrder = homeNavbarService.getMaxOrder();
|
| | | homeNavbar.setOrderby(maxOrder + 1);
|
| | | |
| | | homeNavbarService.insert(homeNavbar);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("添加成功"));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改
|
| | | * @param callback
|
| | | * @param special
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveModify")
|
| | | public void saveModify(String callback, HomeNavbar homeNavbar, PrintWriter out) {
|
| | | try {
|
| | |
|
| | | Long id = homeNavbar.getId();
|
| | | if (id == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("ID不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | String name = homeNavbar.getName();
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("导航名称不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | HomeNavbar resultObj = homeNavbarService.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作数据已不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | homeNavbar.setUpdatetime(new Date());
|
| | | homeNavbarService.updateByPrimaryKeySelective(homeNavbar);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("修改成功"));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 修改系统状态
|
| | | * @param callback
|
| | | * @param type
|
| | | * @param cardId
|
| | | * @param systemId
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveSystemState")
|
| | | public void saveSystemState(String callback, Long id, Long systemId, PrintWriter out) {
|
| | | |
| | | if (id == null || systemId == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | | List<SuperHomeNavbar> list = superHomeNavbarService.querybyNavbarId(id, systemId);
|
| | | |
| | | if (list != null && list.size() > 0) {
|
| | | superHomeNavbarService.deletebyNavbarId(id, systemId);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("check", 0);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } else {
|
| | | |
| | | HomeNavbar homeNavbar = new HomeNavbar();
|
| | | homeNavbar.setId(id);
|
| | | |
| | | System system = new System();
|
| | | system.setId(systemId);
|
| | | |
| | | SuperHomeNavbar superNavbar = new SuperHomeNavbar();
|
| | | superNavbar.setHomeNavbar(homeNavbar);
|
| | | superNavbar.setSystem(system);
|
| | | |
| | | superHomeNavbarService.insertSelective(superNavbar);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("check", 1);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("修改失败"));
|
| | | }
|
| | | |
| | | }
|
| | | |
| | | /**
|
| | | * 修改排序
|
| | | * |
| | | * @param callback
|
| | | * @param goodsClass
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveOrder")
|
| | | public void saveOrder(String callback, Long id, Integer moveType, PrintWriter out) {
|
| | | |
| | | if (moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递的类型不正确"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (id == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("ID不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | |
|
| | | HomeNavbar resultObj = homeNavbarService.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作数据已不存在"));
|
| | | return;
|
| | | }
|
| | | |
| | | Integer oldOrder = resultObj.getOrderby();
|
| | | List<HomeNavbar> list = homeNavbarService.getChangeOrder(id, moveType, oldOrder);
|
| | | |
| | | if (list != null && list.size() > 0) {
|
| | | HomeNavbar changeObj = list.get(0);
|
| | | // 交换排序序号
|
| | | resultObj.setOrderby(changeObj.getOrderby());
|
| | | |
| | | changeObj.setOrderby(oldOrder);
|
| | | |
| | | homeNavbarService.updateByPrimaryKeySelective(changeObj);
|
| | | }
|
| | | |
| | | homeNavbarService.updateByPrimaryKeySelective(resultObj);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | |
|
| | | }
|
| | | |
| | |
|
| | | |
| | | /**
|
| | | * 查询
|
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key 模糊查询:说明、标识
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "query")
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key,
|
| | | Integer sort, PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | if (pageSize == null || pageSize < 1) {
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | | }
|
| | |
|
| | | try {
|
| | | List<HomeNavbar> list = homeNavbarService.listQuery((pageIndex - 1) * pageSize, pageSize, key);
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | | |
| | | long count = homeNavbarService.countlistQuery(key);
|
| | | |
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls(); |
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", gson.toJson(list));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 删除
|
| | | * @param callback
|
| | | * @param idArray
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "delete")
|
| | | public void delete(String callback, String idArray, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | if (StringUtil.isNullOrEmpty(idArray)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {}.getType());
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未检测到删除的数据"));
|
| | | return;
|
| | | }
|
| | | |
| | | int count = homeNavbarService.deleteBatchByPrimaryKey(list);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("成功删除["+ count +"]条数据"));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | @RequestMapping(value = "searchgoods")
|
| | | public void searchgoods(AcceptData acceptData, String kw, int page, String filter, String order, String startprice,
|
| | | String endprice, String fastFilter, PrintWriter out) {
|
| | | String endprice, Double startTkRate, Double endTkRate, String fastFilter, PrintWriter out) {
|
| | |
|
| | | String bid = getHistorySearchBid(acceptData);
|
| | |
|
| | |
| | | JSONObject data = null;
|
| | | if (!recommend) {
|
| | | // 淘宝接口请求
|
| | | data = searchGoods(kw, page, filter, order, startprice, endprice);
|
| | | data = searchGoods(kw, page, filter, order, startprice, endprice, startTkRate, endTkRate);
|
| | | } else {
|
| | | // 推荐:精选库
|
| | | data = searchQualityGoods(kw, page, filter, order, startprice, endprice);
|
| | | data = searchQualityGoods(kw, page, filter, order, startprice, endprice, startTkRate, endTkRate);
|
| | | }
|
| | |
|
| | | // 获取推荐词
|
| | |
| | | * @return
|
| | | */
|
| | | private JSONObject searchGoods(String kw, int page, String filter, String order, String startprice,
|
| | | String endprice) {
|
| | | String endprice, Double startTkRate, Double endTkRate) {
|
| | | page = page + 1;
|
| | |
|
| | | SearchFilter sf = new SearchFilter();
|
| | |
| | |
|
| | | if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(endprice)) {
|
| | | sf.setEndPrice(new BigDecimal(endprice));
|
| | | }
|
| | | |
| | | if (startTkRate != null && startTkRate != 0 && !startTkRate.equals(0)) {
|
| | | BigDecimal b = new BigDecimal(startTkRate/2);
|
| | | double df = b.setScale(2, BigDecimal.ROUND_FLOOR).doubleValue();
|
| | | int tkRate = (int) (df * 100);
|
| | | sf.setStartTkRate(tkRate);
|
| | | }
|
| | | |
| | | if (endTkRate != null && endTkRate != 0 && !endTkRate.equals(0)) {
|
| | | BigDecimal b = new BigDecimal(endTkRate/2);
|
| | | double df = b.setScale(2, BigDecimal.ROUND_FLOOR).doubleValue();
|
| | | int tkRate = (int) (df * 100);
|
| | | sf.setEndTkRate(tkRate);
|
| | | }
|
| | |
|
| | | if (!com.yeshi.fanli.util.StringUtil.isNullOrEmpty(order)) {
|
| | |
| | | * @return
|
| | | */
|
| | | private JSONObject searchQualityGoods(String key, int page, String filter, String order, String startprice,
|
| | | String endprice) {
|
| | | String endprice, Double startTkRate, Double endTkRate) {
|
| | |
|
| | | Integer hasQuan = null;
|
| | | Integer userType = null;
|
| | |
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | List<QualityFactory> listQuery = qualityGoodsService.listRecommendBykey(page * pageSize, pageSize, key, hasQuan,
|
| | | userType, start_Price, end_Price, sort);
|
| | | userType, start_Price, end_Price, startTkRate, endTkRate, sort);
|
| | |
|
| | | List<TaoBaoGoodsBriefExtra> listExtra = new ArrayList<TaoBaoGoodsBriefExtra>();
|
| | | Map<String, String> map = manageService.convertMap();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | long count = qualityGoodsService.countRecommendBykey(key, hasQuan, userType, start_Price, end_Price);
|
| | | long count = qualityGoodsService.countRecommendBykey(key, hasQuan, userType, start_Price, end_Price, startTkRate, endTkRate);
|
| | |
|
| | | // 设置发货地址
|
| | | TaoBaoSearchNav nav = new TaoBaoSearchNav();
|
| | |
| | | package com.yeshi.fanli.dao.mybatis.homemodule; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar; |
| | | |
| | | public interface HomeNavbarMapper { |
| | |
| | | int updateByPrimaryKeySelective(HomeNavbar record); |
| | | |
| | | int updateByPrimaryKey(HomeNavbar record); |
| | | |
| | | /** |
| | | * 根据主键批量删除 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | int deleteBatchByPrimaryKey(List<Long> list); |
| | | |
| | | /** |
| | | * 获取最大的排序值 |
| | | * @param card |
| | | * @return |
| | | */ |
| | | int getMaxOrder(); |
| | | |
| | | /** |
| | | * 查询交换排序对象 |
| | | * @param type |
| | | * @param order 排序值 |
| | | * @return |
| | | */ |
| | | List<HomeNavbar> getChangeOrder(@Param("id") Long id, @Param("type") Integer type, @Param("order") Integer order); |
| | | |
| | | /** |
| | | * 后端列表查询 |
| | | * @param start |
| | | * @param count |
| | | * @param key |
| | | * @return |
| | | */ |
| | | List<HomeNavbar> listQuery(@Param("start") long start, @Param("count") int count, @Param("key") String key); |
| | | |
| | | long countListQuery(@Param("key") String key); |
| | | } |
| | |
| | | List<SuperHomeNavbar> listBySystem(@Param("systemId") Long systemId); |
| | | |
| | | |
| | | /** |
| | | * 根据导航栏id 批量查询 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | List<SuperHomeNavbar> listByNavbarIds(List<Long> list); |
| | | |
| | | |
| | | /** |
| | | * 根据导航栏id 批量删除 |
| | | * @param list |
| | | * @return |
| | | */ |
| | | int deleteBatchByNavbarIds(List<Long> list); |
| | | |
| | | /** |
| | | * 根据系统id+导航id查询 |
| | | * @param systemId 系统id |
| | | * @return |
| | | */ |
| | | List<SuperHomeNavbar> querybyNavbarId(@Param("navbarId") Long navbarId,@Param("systemId") Long systemId); |
| | | |
| | | /** |
| | | * 根据系统id+导航id 删除 |
| | | * @param systemId 系统id |
| | | * @return |
| | | */ |
| | | int deletebyNavbarId(@Param("navbarId") Long navbarId,@Param("systemId") Long systemId); |
| | | |
| | | } |
| | |
| | | List<QualityFactory> listRecommendBykey(@Param("start") long start, @Param("count") int count, |
| | | @Param("key") String key,@Param("hasQuan") Integer hasQuan, @Param("userType") Integer userType, |
| | | @Param("startprice") Double startprice, @Param("endprice") Double endprice, |
| | | @Param("startTkRate") Double startTkRate, @Param("endTkRate") Double endTkRate, |
| | | @Param("sort") Integer sort); |
| | | |
| | | long countRecommendBykey(@Param("key") String key, @Param("hasQuan") Integer hasQuan, |
| | | @Param("userType") Integer userType,@Param("startprice") Double startprice, @Param("endprice") Double endprice); |
| | | @Param("userType") Integer userType,@Param("startprice") Double startprice, |
| | | @Param("endprice") Double endprice,@Param("startTkRate") Double startTkRate, |
| | | @Param("endTkRate") Double endTkRate); |
| | | |
| | | |
| | | List<QualityFactory> listQueryBylabIDs(@Param("start") long start, @Param("count") int count, |
| | |
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.persistence.Column;
|
| | | import javax.persistence.Entity;
|
| | |
| | | import javax.persistence.Id;
|
| | | import javax.persistence.JoinColumn;
|
| | | import javax.persistence.Table;
|
| | | import javax.persistence.Transient;
|
| | |
|
| | | /**
|
| | | * 导航管理
|
| | |
| | | @JoinColumn(name = "br_updatetime")
|
| | | @org.yeshi.utils.mybatis.Column(name = "br_updatetime")
|
| | | private Date updatetime;
|
| | | |
| | | @Transient // 系统关联列表
|
| | | private List<com.yeshi.fanli.entity.system.System> systemList;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | |
| | | this.updatetime = updatetime;
|
| | | }
|
| | |
|
| | | public List<com.yeshi.fanli.entity.system.System> getSystemList() {
|
| | | return systemList;
|
| | | }
|
| | |
|
| | | public void setSystemList(List<com.yeshi.fanli.entity.system.System> systemList) {
|
| | | this.systemList = systemList;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | </set> where br_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="getMaxOrder" resultType="java.lang.Integer"> |
| | | SELECT IFNULL(MAX(br_orderby),0) FROM yeshi_ec_home_navbar |
| | | </select> |
| | | |
| | | <select id="getChangeOrder" resultMap="BaseResultMap"> |
| | | SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_home_navbar |
| | | WHERE br_id = #{id} |
| | | <if test="type == -1"> |
| | | <![CDATA[and br_orderby < #{order}]]> |
| | | order by br_orderby desc |
| | | </if> |
| | | |
| | | <if test="type == 1"> |
| | | <![CDATA[and br_orderby > #{order} ]]> |
| | | order by br_orderby |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="listQuery" resultMap="BaseResultMap"> |
| | | SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_home_navbar |
| | | WHERE 1=1 |
| | | <if test='key != null and key != ""'> |
| | | AND (br_name like '%${key}%') |
| | | </if> |
| | | ORDER BY br_orderby |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="countListQuery" resultType="java.lang.Long"> |
| | | SELECT IFNULL(count(br_id),0) FROM yeshi_ec_home_navbar |
| | | WHERE 1=1 |
| | | <if test='key != null and key != ""'> |
| | | AND (br_name like '%${key}%') |
| | | </if> |
| | | </select> |
| | | |
| | | <delete id="deleteBatchByPrimaryKey" parameterType="java.util.List"> |
| | | delete from yeshi_ec_home_navbar WHERE br_id in |
| | | <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | </delete> |
| | | |
| | | </mapper> |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="listByNavbarIds" parameterType="java.util.List" resultMap="BaseResultMap"> |
| | | SELECT <include refid="Base_Column_List"/> FROM `yeshi_ec_super_homenavbar` |
| | | WHERE sp_navbar_id in <foreach collection="list" item="item" open="(" separator="," close=")">#{item}</foreach> |
| | | </select> |
| | | |
| | | <delete id="deleteBatchByNavbarIds" parameterType="java.util.List"> |
| | | delete from yeshi_ec_super_homenavbar WHERE sp_navbar_id in |
| | | <foreach collection="list" item="item" open="(" close=")" |
| | | separator=",">#{item}</foreach> |
| | | </delete> |
| | | |
| | | <select id="querybyNavbarId" resultMap="BaseResultMap"> |
| | | SELECT * FROM `yeshi_ec_super_homenavbar` WHERE sp_navbar_id = #{navbarId} and sp_system_id = #{systemId} |
| | | </select> |
| | | |
| | | <delete id="deletebyNavbarId"> |
| | | delete from yeshi_ec_super_homenavbar WHERE sp_navbar_id = #{navbarId} and sp_system_id = #{systemId} |
| | | </delete> |
| | | |
| | | </mapper> |
| | |
| | | <if test='endprice != null'> |
| | | AND <![CDATA[ tb.`zkPrice` <= #{endprice}]]> |
| | | </if> |
| | | <!-- 返利比范围 --> |
| | | <if test='startTkRate != null'> |
| | | AND <![CDATA[ tb.`tkRate` >= #{startTkRate}]]> |
| | | </if> |
| | | <if test='endTkRate != null'> |
| | | AND <![CDATA[ tb.`tkRate` <= #{endTkRate}]]> |
| | | </if> |
| | | <!-- 有券 --> |
| | | <if test='hasQuan != null'> |
| | | AND <![CDATA[ tb.`couponLeftCount` > 1]]> |
| | |
| | | <if test='endprice != null'> |
| | | AND <![CDATA[ tb.`zkPrice` <= #{endprice}]]> |
| | | </if> |
| | | <!-- 返利比范围 --> |
| | | <if test='startTkRate != null'> |
| | | AND <![CDATA[ tb.`tkRate` >= #{startTkRate}]]> |
| | | </if> |
| | | <if test='endTkRate != null'> |
| | | AND <![CDATA[ tb.`tkRate` <= #{endTkRate}]]> |
| | | </if> |
| | | <!-- 有券 --> |
| | | <if test='hasQuan != null'> |
| | | AND <![CDATA[ tb.`couponLeftCount` > 1]]> |
| | |
| | | package com.yeshi.fanli.service.impl.homemodule;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.transaction.Transactional;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.homemodule.HomeNavbarMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.homemodule.SuperHomeNavbarMapper;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SuperHomeNavbar;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.HomeNavbarService;
|
| | |
|
| | |
|
| | |
| | | public class HomeNavbarServiceImpl implements HomeNavbarService {
|
| | |
|
| | | @Resource
|
| | | private SystemService systemService;
|
| | | @Resource
|
| | | private HomeNavbarMapper homeNavbarMapper;
|
| | | @Resource
|
| | | private SuperHomeNavbarMapper superHomeNavbarMapper;
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | | return homeNavbarMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public int deleteBatchByPrimaryKey(List<Long> list) {
|
| | | superHomeNavbarMapper.deleteBatchByNavbarIds(list);
|
| | | return homeNavbarMapper.deleteBatchByPrimaryKey(list);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getMaxOrder() {
|
| | | return homeNavbarMapper.getMaxOrder();
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<HomeNavbar> getChangeOrder(Long id, Integer type, Integer order) {
|
| | | return homeNavbarMapper.getChangeOrder(id, type, order);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<HomeNavbar> listQuery(long start, int count, String key) {
|
| | | |
| | | List<HomeNavbar> listObj = homeNavbarMapper.listQuery(start, count, key);
|
| | | if (listObj == null || listObj.size() == 0) {
|
| | | return null;
|
| | | }
|
| | | |
| | | List<System> systemList = systemService.getSystems();
|
| | | |
| | | List<Long> listId = new ArrayList<Long>();
|
| | | for (HomeNavbar homeNavbar: listObj) {
|
| | | listId.add(homeNavbar.getId());
|
| | | }
|
| | | List<SuperHomeNavbar> listSuper = superHomeNavbarMapper.listByNavbarIds(listId);
|
| | | |
| | | if (listSuper == null || listSuper.size() == 0) {
|
| | | |
| | | for (HomeNavbar homeNavbar: listObj) {
|
| | | homeNavbar.setSystemList(systemList);
|
| | | }
|
| | | |
| | | } else {
|
| | | for (HomeNavbar homeNavbar: listObj) {
|
| | | |
| | | Long id = homeNavbar.getId();
|
| | | List<System> newList = new ArrayList<System>();
|
| | | |
| | | // 是否有关联系统选项
|
| | | for (System dsystem : systemList) {
|
| | | |
| | | System newsystem = new System();
|
| | | try {
|
| | | PropertyUtils.copyProperties(newsystem, dsystem);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | if (listSuper != null && listSuper.size() > 0) {
|
| | | Long systemId = newsystem.getId();
|
| | | |
| | | for (SuperHomeNavbar superHomeNavbar : listSuper) {
|
| | | HomeNavbar navbar = superHomeNavbar.getHomeNavbar();
|
| | | System system = superHomeNavbar.getSystem();
|
| | | |
| | | // 当前专题 、当前系统
|
| | | if (navbar != null && system != null && id == navbar.getId() |
| | | && systemId == system.getId()) {
|
| | | newsystem.setCheck(1);
|
| | | break;
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | |
| | | if (newsystem.getCheck() != 1) {
|
| | | newsystem.setCheck(0);
|
| | | }
|
| | | |
| | | newList.add(newsystem);
|
| | | }
|
| | | |
| | | homeNavbar.setSystemList(newList);
|
| | | }
|
| | | }
|
| | | |
| | | return listObj;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countlistQuery(String key) {
|
| | | return homeNavbarMapper.countListQuery(key);
|
| | | }
|
| | |
|
| | |
|
| | | |
| | | |
| | |
|
| | | }
|
| | |
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public List<SuperHomeNavbar> listByNavbarIds(List<Long> list) {
|
| | | return superHomeNavbarMapper.listByNavbarIds(list);
|
| | | }
|
| | | |
| | | @Override
|
| | | public void deleteBatchByNavbarIds(List<Long> list) {
|
| | | superHomeNavbarMapper.deleteBatchByNavbarIds(list);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<SuperHomeNavbar> querybyNavbarId(Long navbarId, Long systemId) {
|
| | | return superHomeNavbarMapper.querybyNavbarId(navbarId, systemId);
|
| | | }
|
| | | |
| | | @Override
|
| | | public int deletebyNavbarId(Long navbarId, Long systemId) {
|
| | | return superHomeNavbarMapper.deletebyNavbarId(navbarId, systemId);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | }
|
| | |
| | |
|
| | | @Override
|
| | | public List<QualityFactory> listRecommendBykey(long start, int count, String key, Integer hasQuan,
|
| | | Integer userType, Double startprice, Double endprice, Integer sort) {
|
| | | Integer userType, Double startprice, Double endprice, Double startTkRate, Double endTkRate, Integer sort) {
|
| | | return qualityFactoryMapper.listRecommendBykey(start, count, key, hasQuan, userType,
|
| | | startprice, endprice, sort);
|
| | | startprice, endprice, startTkRate, endTkRate, sort);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countRecommendBykey(String key, Integer hasQuan, Integer userType,
|
| | | Double startprice, Double endprice) {
|
| | | return qualityFactoryMapper.countRecommendBykey(key, hasQuan, userType, startprice, endprice);
|
| | | Double startprice, Double endprice, Double startTkRate, Double endTkRate) {
|
| | | return qualityFactoryMapper.countRecommendBykey(key, hasQuan, userType, startprice, endprice, startTkRate, endTkRate);
|
| | | }
|
| | |
|
| | |
|
| | |
| | | package com.yeshi.fanli.service.inter.homemodule;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.homemodule.HomeNavbar;
|
| | |
|
| | | /**
|
| | |
| | | public int updateByPrimaryKeySelective(HomeNavbar record);
|
| | |
|
| | | public int updateByPrimaryKey(HomeNavbar record);
|
| | | |
| | | /**
|
| | | * 根据主键批量删除
|
| | | * @param list
|
| | | * @return
|
| | | */
|
| | | int deleteBatchByPrimaryKey(List<Long> list);
|
| | | |
| | | /**
|
| | | * 获取最大的排序值
|
| | | * @param card
|
| | | * @return
|
| | | */
|
| | | int getMaxOrder();
|
| | | |
| | | /**
|
| | | * 查询交换排序对象
|
| | | * @param type |
| | | * @param order 排序值
|
| | | * @return
|
| | | */
|
| | | List<HomeNavbar> getChangeOrder(Long id, Integer type, Integer order);
|
| | | |
| | | /**
|
| | | * 后端列表查询
|
| | | * @param start
|
| | | * @param count
|
| | | * @param key
|
| | | * @return
|
| | | */
|
| | | List<HomeNavbar> listQuery(long start, int count, String key);
|
| | | |
| | | long countlistQuery(String key);
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | List<SuperHomeNavbar> listBySystemCache(Long systemId);
|
| | | |
| | | |
| | | /**
|
| | | * 根据导航栏id 批量查询
|
| | | * @param list
|
| | | * @return
|
| | | */
|
| | | List<SuperHomeNavbar> listByNavbarIds(List<Long> list);
|
| | | |
| | | |
| | | /**
|
| | | * 根据导航栏id 批量删除
|
| | | * @param list
|
| | | * @return
|
| | | */
|
| | | void deleteBatchByNavbarIds(List<Long> list);
|
| | | |
| | | /**
|
| | | * 根据系统id+导航id查询
|
| | | * @param systemId 系统id
|
| | | * @return
|
| | | */
|
| | | List<SuperHomeNavbar> querybyNavbarId(Long navbarId, Long systemId);
|
| | | |
| | | /**
|
| | | * 根据系统id+导航id 删除
|
| | | * @param systemId 系统id
|
| | | * @return
|
| | | */
|
| | | int deletebyNavbarId(Long navbarId, Long systemId);
|
| | | |
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public List<QualityFactory> listRecommendBykey(long start, int count, String key, Integer hasQuan,
|
| | | Integer userType, Double startprice, Double endprice, Integer sort);
|
| | | Integer userType, Double startprice, Double endprice, Double startTkRate, Double endTkRate, Integer sort);
|
| | |
|
| | | public long countRecommendBykey(String key, Integer hasQuan, Integer userType,
|
| | | Double startprice, Double endprice);
|
| | | Double startprice, Double endprice, Double startTkRate, Double endTkRate);
|
| | |
|
| | |
|
| | | /**
|