| | |
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.CustomerContentService;
|
| | | import com.yeshi.fanli.service.inter.config.CustomerNameService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemConfigService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService;
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoUnionConfigService taoBaoUnionConfigService;
|
| | | |
| | | @Resource
|
| | | private CustomerNameService customerNameService;
|
| | | |
| | | @Resource
|
| | | private CustomerContentService customerContentService;
|
| | |
|
| | | private static final String DOWNURL = "http://sj.qq.com/myapp/detail.htm?apkName="
|
| | | + Constant.systemCommonConfig.getAndroidPackageName();
|
| | |
| | | public void getHelpList(PrintWriter out) {
|
| | | List<CustomerName> totalList = new ArrayList<>();
|
| | | int page = 0;
|
| | | List<CustomerName> customerNameList = systemClientParamsService.customerNameList(page, "", 1);
|
| | | List<CustomerName> customerNameList = customerNameService.customerNameList(page, "", 1);
|
| | | if (customerNameList != null && customerNameList.size() > 0)
|
| | | totalList.addAll(customerNameList);
|
| | |
|
| | | while (customerNameList != null && customerNameList.size() == Constant.PAGE_SIZE) {
|
| | | page++;
|
| | | customerNameList = systemClientParamsService.customerNameList(page, "", 1);
|
| | | customerNameList = customerNameService.customerNameList(page, "", 1);
|
| | | if (customerNameList != null && customerNameList.size() > 0)
|
| | | totalList.addAll(customerNameList);
|
| | | }
|
| | |
|
| | | // 获取每个下面的详情
|
| | | for (CustomerName cn : totalList) {
|
| | | List<CustomerContent> contentList = systemClientParamsService.getSecondProblemList(0, "", cn.getId());
|
| | | List<CustomerContent> contentList = customerContentService.getSecondProblemList(0, "", cn.getId());
|
| | | cn.setCustomerContentList(contentList);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(totalList)));
|
| | |
| | | @RequestMapping("getHelpDetail")
|
| | | public void getHelpDetail(long id, PrintWriter out) {
|
| | | List<CustomerName> totalList = new ArrayList<>();
|
| | | CustomerContent customerContent = systemClientParamsService.getCustomerContent(id);
|
| | | CustomerContent customerContent = customerContentService.getCustomerContent(id);
|
| | | out.print(JsonUtil.loadTrueResult(customerContent.getContent().replace("\n", "<br>")));
|
| | | }
|
| | |
|
| | |
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.springframework.web.bind.annotation.RequestParam;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.springframework.web.multipart.MultipartHttpServletRequest;
|
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.admin.GoodsClassAdmin;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.exception.FloatADException;
|
| | | import com.yeshi.fanli.exception.GoodsClassException;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperGoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelClassService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | @Resource
|
| | | private BusinessSystemService businessSystemService;
|
| | |
|
| | | @RequestMapping(value = "getGoodsClassList")
|
| | | public void getGoodsClassList(String callback, Integer pageIndex, String platform, String packages, String key, PrintWriter out) {
|
| | |
|
| | | List<GoodsClassAdmin> goodsClassList = goodsClassService.getGoodsClassAdmins(pageIndex - 1, platform, packages, key);
|
| | |
|
| | | int count = goodsClassService.getCount(platform, packages, key);
|
| | | int totalPage = count % Constant.PAGE_SIZE == 0 ? count / Constant.PAGE_SIZE : count / Constant.PAGE_SIZE + 1;
|
| | | PageEntity pe = new PageEntity(pageIndex, Constant.PAGE_SIZE, count, totalPage);
|
| | | Map<String, String> map = new HashMap<String, String>();
|
| | | map.put("platform", platform);
|
| | | map.put("packages", packages);
|
| | | map.put("key", key);
|
| | | pe.setParams(map);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | List<BusinessSystem> systemList = businessSystemService.getBusinessSystems();
|
| | |
|
| | | data.put("systemList", systemList);
|
| | | data.put("goodsClassList", goodsClassList);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "queryAll")
|
| | | public void queryAll(String callback, String platform, String packages, PrintWriter out) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | @RequestMapping(value = "getGoodsClass", method = RequestMethod.POST)
|
| | | public void getGoodsClass(long id, PrintWriter out) {
|
| | | GoodsClass rb = goodsClassService.getGoodsClass(id);
|
| | | if (rb != null) {
|
| | | out.print(JsonUtil.loadTrueResult(rb));
|
| | | return;
|
| | | }
|
| | | out.print(JsonUtil.loadFalseResult("不存在该GoodsClass"));
|
| | | }
|
| | |
|
| | |
|
| | | |
| | | /**
|
| | | * 添加类别
|
| | | * 保存信息
|
| | | *
|
| | | * @param callback
|
| | | * @param goodsClass
|
| | | * @param request
|
| | | * @param special
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveAdd", method = RequestMethod.POST)
|
| | | public void saveAdd(String callback, GoodsClass goodsClass, HttpServletRequest request, PrintWriter out) {
|
| | | @RequestMapping(value = "save")
|
| | | public void save(String callback, GoodsClass goodsClass, String jumpType, HttpServletRequest request,PrintWriter out) {
|
| | | try {
|
| | |
|
| | | String name = goodsClass.getName();
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("类别名称不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 1. 先判断httpRequest 是否含有文件类型 |
| | | if (request instanceof MultipartHttpServletRequest) {
|
| | |
|
| | | long result;
|
| | | List<MultipartFile> files = ((MultipartHttpServletRequest) request).getFiles("file");
|
| | |
|
| | | goodsClass.setAndroidClick(0L);
|
| | | goodsClass.setIosClick(0L);
|
| | | // 搜索条件:有券、在售价20-200、牛皮癣轻微
|
| | | goodsClass.setSearchParam("{\"quan\":1,\"endPrice\":220,\"includeGoodRate\":true,\"baoYou\":true,\"ip\":\"218.72.111.105\"}");
|
| | | |
| | | if (files != null && files.size() > 0) {
|
| | | // 图片文件上传
|
| | | result = goodsClassService.saveAdd(goodsClass, files.get(0));
|
| | | } else {
|
| | | // 无图保存
|
| | | result = goodsClassService.saveAdd(goodsClass, null);
|
| | | }
|
| | |
|
| | | if (result > 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | } else {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败"));
|
| | | }
|
| | |
|
| | | } else {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请传递正确的参数"));
|
| | | }
|
| | |
|
| | | MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
|
| | | goodsClassService.saveObject(fileRequest.getFile("file"), goodsClass);
|
| | | }else{
|
| | | goodsClassService.saveObject(null, goodsClass);
|
| | | }
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (FloatADException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 保存修改信息
|
| | | * 修改排序
|
| | | *
|
| | | * @param callback
|
| | | * @param goodsClass
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveModify")
|
| | | public void saveModify(String callback, GoodsClass goodsClass, PrintWriter out) {
|
| | |
|
| | | @RequestMapping(value = "updateOrder")
|
| | | public void updateOrder(String callback, Long id, Integer moveType, PrintWriter out) {
|
| | | try {
|
| | |
|
| | | Long id = goodsClass.getId();
|
| | |
|
| | | GoodsClass resultObj = goodsClassService.getGoodsClass(id);
|
| | |
|
| | | if (resultObj == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该类别不存在或已被删除"));
|
| | | } else {
|
| | | String name = goodsClass.getName();
|
| | | if (!StringUtil.isNullOrEmpty(name)) {
|
| | | resultObj.setName(name);
|
| | | }
|
| | | |
| | | String key = goodsClass.getKey();
|
| | | if (!StringUtil.isNullOrEmpty(key)) {
|
| | | resultObj.setKey(key);
|
| | | }
|
| | |
|
| | | goodsClassService.updateGoodsClass(resultObj);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("修改成功"));
|
| | | }
|
| | |
|
| | | goodsClassService.updateOrder(id, moveType);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
|
| | | } catch (GoodsClassException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 保存修改信息
|
| | | * |
| | | * @param callback
|
| | | * @param goodsClass
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveOrderby")
|
| | | public void saveOrderby(String callback, Long id, int orderby, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | | GoodsClass resultObj = goodsClassService.getGoodsClass(id);
|
| | |
|
| | | if (resultObj == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该类别不存在或已被删除"));
|
| | | } else {
|
| | |
|
| | | List<GoodsClass> glist = goodsClassService.getByorderby(orderby);
|
| | | if (glist != null && glist.size() > 0) {
|
| | | GoodsClass changeObj = glist.get(0);
|
| | | changeObj.setOrderby(resultObj.getOrderby());
|
| | | goodsClassService.updateGoodsClass(changeObj);
|
| | | }
|
| | |
|
| | | resultObj.setOrderby(orderby);
|
| | | goodsClassService.updateGoodsClass(resultObj);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("修改成功"));
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 批量删除
|
| | | *
|
| | |
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | // TODO Auto-generated catch block
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | //
|
| | | /**
|
| | | * 上传/修改 图片
|
| | | * |
| | | * @param callback
|
| | | * @param file
|
| | | * @param request
|
| | | * @param out
|
| | | * @param response
|
| | | */
|
| | | @RequestMapping(value = "uploadPicture")
|
| | | public void uploadPicture(Long id, @RequestParam("file") CommonsMultipartFile file, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | GoodsClass goodsClass = goodsClassService.getGoodsClass(id);
|
| | |
|
| | | if (goodsClass == null ) {
|
| | | out.print(JsonUtil.loadFalseResult("该类别不存在或已被删除"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (file == null) {
|
| | | out.print(JsonUtil.loadFalseResult("图片文件不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | goodsClassService.uploadPicture(goodsClass, file);
|
| | | out.print(JsonUtil.loadTrueResult("上传成功"));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 删除图片
|
| | |
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("操作异常")));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "setSuperSystem")
|
| | |
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.springframework.web.bind.annotation.RequestParam;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.springframework.web.multipart.MultipartHttpServletRequest;
|
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | |
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
|
| | | import com.yeshi.fanli.exception.FloatADException;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelClassService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/goodsSubClass")
|
| | |
| | | @Resource
|
| | | private LabelClassService labelClassService;
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 添加类别
|
| | | * 保存信息
|
| | | *
|
| | | * @param callback
|
| | | * @param goodsSubClass
|
| | | * @param request
|
| | | * @param special
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveAdd", method = RequestMethod.POST)
|
| | | public void saveAdd(String callback, Long pid, Integer type, GoodsSubClass goodsSubClass, |
| | | HttpServletRequest request, PrintWriter out) {
|
| | | @RequestMapping(value = "save")
|
| | | public void save(String callback, GoodsSubClass goodsSubClass, Long pid, Integer type, HttpServletRequest request,PrintWriter out) {
|
| | | try {
|
| | |
|
| | | String name = goodsSubClass.getName();
|
| | | if (StringUtil.isNullOrEmpty(name)) {
|
| | | out.print(JsonUtil.loadFalseResult("类别名称不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (pid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("上级id为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (type == null) {
|
| | | out.print(JsonUtil.loadFalseResult("等级不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (type > 5) {
|
| | | out.print(JsonUtil.loadFalseResult("等级不能超过五级"));
|
| | | return;
|
| | | }
|
| | | |
| | | String key = goodsSubClass.getKey();
|
| | | if (StringUtil.isNullOrEmpty(key)) {
|
| | | goodsSubClass.setKey(name.trim());
|
| | | }
|
| | | |
| | | // 默认停用
|
| | | goodsSubClass.setState(0);
|
| | | |
| | | // 1. 先判断httpRequest 是否含有文件类型 |
| | | if (request instanceof MultipartHttpServletRequest) {
|
| | |
|
| | | int result;
|
| | | List<MultipartFile> files = ((MultipartHttpServletRequest) request).getFiles("file");
|
| | | |
| | | goodsSubClass.setAndroidClick(0L);
|
| | | goodsSubClass.setIosClick(0L);
|
| | | goodsSubClass.setLevel(type);
|
| | | goodsSubClass.setCreatetime(new Date());
|
| | | goodsSubClass.setUpdatetime(new Date());
|
| | | // 搜索条件:有券、在售价20-200、牛皮癣轻微
|
| | | goodsSubClass.setSearchJson("{\"quan\":1,\"endPrice\":220,\"includeGoodRate\":true}");
|
| | | |
| | | if (type == 2) {
|
| | | goodsSubClass.setRootClass(new GoodsClass(pid));
|
| | | int weight = goodsSubClassService.getMaxWeightByRootId(pid);
|
| | | goodsSubClass.setWeight(weight + 1);
|
| | | } else {
|
| | | goodsSubClass.setParent(new GoodsSubClass(pid));
|
| | | int weight = goodsSubClassService.getMaxWeightByPid(pid);
|
| | | goodsSubClass.setWeight(weight + 1);
|
| | | }
|
| | | |
| | | |
| | | |
| | | if (files != null && files.size() > 0) {
|
| | | // 图片文件上传
|
| | | result = goodsSubClassService.save(goodsSubClass, files.get(0));
|
| | | } else {
|
| | | // 无图保存
|
| | | result = goodsSubClassService.save(goodsSubClass, null);
|
| | | }
|
| | |
|
| | | if (result == 1) {
|
| | | out.print(JsonUtil.loadTrueResult("保存成功"));
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult("保存失败"));
|
| | | }
|
| | |
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult("请传递正确的参数"));
|
| | | }
|
| | |
|
| | | MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
|
| | | goodsSubClassService.saveObject(fileRequest.getFile("file"), goodsSubClass, type, pid);
|
| | | }else{
|
| | | goodsSubClassService.saveObject(null, goodsSubClass, type, pid);
|
| | | }
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (FloatADException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("操作异常"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 保存修改信息
|
| | | * |
| | | * @param callback
|
| | | * @param goodsSubClass
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveModify")
|
| | | public void saveModify(String callback, GoodsSubClass goodsSubClass, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | | Long id = goodsSubClass.getId();
|
| | | if (id == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("不存在该类别"));
|
| | | return;
|
| | | }
|
| | | |
| | | GoodsSubClass resultObj = goodsSubClassService.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("不存在该类别"));
|
| | | return;
|
| | | } |
| | | |
| | | GoodsSubClass subClass = new GoodsSubClass();
|
| | | |
| | | String name = goodsSubClass.getName();
|
| | | if (!StringUtil.isNullOrEmpty(name)) {
|
| | | subClass.setName(name);
|
| | | }
|
| | | // 关键词可以为空
|
| | | subClass.setKey(goodsSubClass.getKey());
|
| | | |
| | | subClass.setId(id);
|
| | | subClass.setUpdatetime(new Date());
|
| | | subClass.setAndroidClick(resultObj.getAndroidClick());
|
| | | subClass.setIosClick(resultObj.getIosClick());
|
| | | goodsSubClassService.updateByPrimaryKeySelective(subClass);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("修改成功"));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("修改失败"));
|
| | | e.printStackTrace();
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 批量删除
|
| | |
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | // TODO Auto-generated catch block
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("操作异常")));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 上传/修改 图片
|
| | | * |
| | | * @param callback
|
| | | * @param file
|
| | | * @param request
|
| | | * @param out
|
| | | * @param response
|
| | | */
|
| | | @RequestMapping(value = "uploadPicture")
|
| | | public void uploadPicture(Long id, @RequestParam("file") CommonsMultipartFile file, PrintWriter out) {
|
| | | if (file == null) {
|
| | | out.print(JsonUtil.loadFalseResult("图片文件不能为空"));
|
| | | return;
|
| | | }
|
| | | |
| | | try {
|
| | |
|
| | | GoodsSubClass goodsSubClass = goodsSubClassService.selectByPrimaryKey(id);
|
| | | if (goodsSubClass == null) {
|
| | | out.print(JsonUtil.loadFalseResult("该类别不存在或已被删除"));
|
| | | return;
|
| | | }
|
| | |
|
| | |
|
| | | int result = goodsSubClassService.uploadPicture(goodsSubClass, file);
|
| | | if (result == 1) {
|
| | | out.print(JsonUtil.loadTrueResult("上传成功"));
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult("上传失败"));
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除图片
|
| | |
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("操作异常")));
|
| | | }
|
| | |
| | | goodsSubClass.setCountClick(0l);
|
| | | }
|
| | |
|
| | | String searchJson = goodsSubClass.getSearchJson();
|
| | | if (searchJson == null) {
|
| | | goodsSubClass.setSearchParam("");
|
| | | } else {
|
| | | goodsSubClass.setSearchParam(searchJson);
|
| | | }
|
| | | |
| | | |
| | | int countlabel = labelClassService.getCountQueryBySubClassId(goodsSubClass.getId());
|
| | | goodsSubClass.setCountlabel(countlabel);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls(); // 重点
|
| | |
| | | */
|
| | | @RequestMapping(value = "saveOrder")
|
| | | public void saveOrder(String callback, Long id, Integer type, Integer moveType, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | | if (moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) {
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | |
|
| | | GoodsSubClass resultObj = goodsSubClassService.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("不存在该类别"));
|
| | |
| | | changeObj.setWeight(resultWeight);
|
| | |
|
| | | changeObj.setUpdatetime(new Date());
|
| | | goodsSubClassService.updateByPrimaryKey(changeObj);
|
| | | goodsSubClassService.updateByPrimaryKeySelective(changeObj);
|
| | | }
|
| | |
|
| | | resultObj.setUpdatetime(new Date());
|
| | | goodsSubClassService.updateByPrimaryKey(resultObj);
|
| | | goodsSubClassService.updateByPrimaryKeySelective(resultObj);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
|
| | |
|
| | |
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | |
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 修改排序
|
| | | * |
| | | * @param callback
|
| | | * @param goodsClass
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveState")
|
| | | public void saveState(String callback, Long id, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | |
| | | if (id == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("不存在该类别"));
|
| | | return;
|
| | | }
|
| | | |
| | | GoodsSubClass resultObj = goodsSubClassService.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("不存在该类别"));
|
| | | return;
|
| | | } |
| | | |
| | | Integer state = resultObj.getState();
|
| | | if (state.equals(1) || state == 1) {
|
| | | state = 0;
|
| | | } else {
|
| | | state = 1;
|
| | | }
|
| | | |
| | | resultObj.setState(state);
|
| | | resultObj.setUpdatetime(new Date());
|
| | | goodsSubClassService.updateByPrimaryKeySelective(resultObj);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(state));
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | goodsClass.setIosClick(1L);
|
| | | }
|
| | | }
|
| | | goodsClassService.updateByPrimaryKeySelective(goodsClass);
|
| | | |
| | | GoodsClass gc = new GoodsClass();
|
| | | gc.setId(goodsClass.getId());
|
| | | gc.setIosClick(goodsClass.getIosClick());
|
| | | gc.setAndroidClick(goodsClass.getAndroidClick());
|
| | | goodsClassService.updateByPrimaryKeySelective(gc);
|
| | | }
|
| | | });
|
| | |
|
| | |
| | | if (meterialId > 0)
|
| | | result = TaoKeApiUtil.getMaterialByMaterialId(meterialId, page, 20);
|
| | | else
|
| | | result = TaoKeApiUtil.searchCouple(goodsClassService.getKwById(id), null, page, 20);
|
| | | result = TaoKeApiUtil.searchCouple(goodsClassService.getKeysById(id), null, page, 20);
|
| | |
|
| | | List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav();
|
| | | if (result.getNavList() != null)
|
| | |
| | | import java.util.ArrayList;
|
| | | import java.util.HashSet;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchNav;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.service.inter.config.CustomerContentService;
|
| | | import com.yeshi.fanli.service.inter.config.SuperHotSearchService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.user.HistorySearchService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("api/h5/v1/webSearch")
|
| | |
| | |
|
| | | @Resource
|
| | | private SuperHotSearchService superHotSearchSerivce;
|
| | | |
| | | @Resource
|
| | | private CustomerContentService customerContentService;
|
| | |
|
| | | // 优惠券
|
| | | /*
|
| | |
| | | @RequestMapping(value = "contactCustomer", method = RequestMethod.GET)
|
| | | public void contactCustomerService(PrintWriter out) {
|
| | | String title = "联系客服";
|
| | | List<CustomerContent> contentList = systemClientParamsService.contactCustomerService(title);
|
| | | List<CustomerContent> contentList = customerContentService.contactCustomerService(title);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("contentList", JsonUtil.getSimpleGsonWithDate().toJson(contentList));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.yeshi.fanli.dao.BaseMapper;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | |
|
| | | public interface GoodsClassMapper {
|
| | | public interface GoodsClassMapper extends BaseMapper<GoodsClass>{
|
| | |
|
| | | String getKwById(Long id);
|
| | | /**
|
| | | * 查询搜索关键词
|
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | String getKeysById(Long id);
|
| | |
|
| | | GoodsClass selectByPrimaryKey(Long id);
|
| | |
|
| | | // 查询所有
|
| | | List<GoodsClass> queryAll();
|
| | | /**
|
| | | * 根据名称模糊搜索
|
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | List<GoodsClass> listByName(@Param("start") long start, @Param("count") int count, @Param("name")String name);
|
| | |
|
| | | int updateByPrimaryKeySelective(GoodsClass record);
|
| | | |
| | | /**
|
| | | * 根据名称模糊搜索
|
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | int countByName(@Param("name")String name, @Param("systemId")Long systemId);
|
| | |
|
| | | /**
|
| | | * 根据系统id查询分类
|
| | |
| | | * @return
|
| | | */
|
| | | List<GoodsClass> listGoodsClassBySystemId(@Param("systemId") Long systemId);
|
| | | |
| | | /**
|
| | | * 根据排序查询
|
| | | * @param orderby
|
| | | * @return
|
| | | */
|
| | | GoodsClass getByAdjoinOrder(@Param("order") Integer order, @Param("type") Integer type);
|
| | | |
| | | |
| | | List<GoodsClass> getGoodsClassAll();
|
| | | |
| | | /**
|
| | | * 获取最大排序值
|
| | | * @return
|
| | | */
|
| | | int getMaxOrder();
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass; |
| | | |
| | | public interface GoodsSecondClassMapper extends BaseMapper<GoodsSecondClass>{ |
| | | |
| | | /** |
| | | * 根据上级分类ID查询 |
| | | * @param pid |
| | | * @return |
| | | */ |
| | | List<GoodsSecondClass> getByGoodsClassId(@Param("pid") Long pid); |
| | | |
| | | /** |
| | | * 根据上级分类ID查询 |
| | | * @param pid |
| | | * @return |
| | | */ |
| | | List<GoodsSecondClass> getByNameAndGoodsClassId(@Param("start") long start, @Param("count") int count, |
| | | @Param("pid") Long pid, @Param("name") String name); |
| | | |
| | | |
| | | int countByNameAndGoodsClassId(@Param("pid") Long pid, @Param("name") String name); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.yeshi.fanli.dao.BaseMapper;
|
| | | import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass;
|
| | |
|
| | | public interface SuperGoodsClassMapper extends BaseMapper<SuperGoodsClass>{
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 根据系统id
|
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | List<SuperGoodsClass> listBySystemId(@Param("systemId") Long systemId);
|
| | | |
| | | /**
|
| | | * 根据分类id 批量查询
|
| | | * @param list
|
| | | * @return
|
| | | */
|
| | | List<SuperGoodsClass> listByGoodsclassIds(@Param("list") List<Long> list);
|
| | | |
| | | |
| | | /**
|
| | | * 根据系统id 分类名称模糊查询
|
| | | * @param start
|
| | | * @param count
|
| | | * @param name
|
| | | * @param systemId
|
| | | * @return
|
| | | */
|
| | | List<SuperGoodsClass> listBySystemIdAmdClassName(@Param("start") long start, @Param("count") int count,
|
| | | @Param("name")String name, @Param("systemId") Long systemId);
|
| | | |
| | | |
| | | /**
|
| | | * 根据分类id 删除
|
| | | * @param goodsClassId
|
| | | * @param systemId
|
| | | * @return
|
| | | */
|
| | | void deleteByClassId(@Param("goodsClassId")Long goodsClassId);
|
| | | |
| | | |
| | | /**
|
| | | * 根据系统id 和分类id 删除
|
| | | * @param goodsClassId
|
| | | * @param systemId
|
| | | * @return
|
| | | */
|
| | | Integer deleteBySystemIdAndClassId(@Param("goodsClassId")Long goodsClassId, @Param("systemId") Long systemId);
|
| | | |
| | | }
|
| | |
| | | import java.io.Serializable;
|
| | | import java.util.List;
|
| | |
|
| | | 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 javax.persistence.Transient;
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | |
|
| | |
| | | *
|
| | | * @author Administrator
|
| | | *
|
| | | *
|
| | | */
|
| | | @Entity
|
| | | @Table(name = "yeshi_ec_class")
|
| | | public class GoodsClass implements Serializable{
|
| | | @Table("yeshi_ec_class")
|
| | | public class GoodsClass implements Serializable {
|
| | |
|
| | | /**
|
| | | *
|
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | @Id
|
| | | @GeneratedValue(strategy = GenerationType.AUTO)
|
| | | @Column(name = "id")
|
| | | private long id;
|
| | | private Long id;
|
| | |
|
| | | @Column(name = "`name`", length = 50)
|
| | | @Column(name = "name")
|
| | | private String name;
|
| | |
|
| | | @Column(name = "`picture`", length = 1024)
|
| | | @Column(name = "picture")
|
| | | private String picture;
|
| | |
|
| | | @Column(name = "url")
|
| | | private String url;
|
| | |
|
| | | @Column(name = "`key`", length = 50)
|
| | | @Column(name = "key")
|
| | | private String key;
|
| | |
|
| | | |
| | | @Column(name = "`search_param`", length = 1024)
|
| | | @Column(name = "search_param")
|
| | | private String searchParam;
|
| | |
|
| | | // @Column(name = "`tbcates`", length = 1024)
|
| | | // private String tbCates;
|
| | |
|
| | | private int orderby;
|
| | | @Column(name = "orderby")
|
| | | private Integer orderby;
|
| | |
|
| | | private long createtime;
|
| | | @Column(name = "createtime")
|
| | | private Long createtime;
|
| | |
|
| | | @Column(name = "ios_click")
|
| | | private Long iosClick = 0l;
|
| | | private Long iosClick;
|
| | |
|
| | | @Column(name = "android_click")
|
| | | private Long androidClick = 0l;
|
| | | private Long androidClick;
|
| | |
|
| | | @Transient // 点击次数
|
| | | |
| | | // 点击次数
|
| | | private Long countClick = 0l;
|
| | | |
| | | @Transient // 关联标签数量
|
| | | // 关联标签数量
|
| | | private int countlabel = 0;
|
| | | |
| | | @Transient // 系统关联列表
|
| | | // 系统关联列表
|
| | | private List<BusinessSystem> systemList;
|
| | |
|
| | | |
| | | public GoodsClass() {
|
| | | }
|
| | |
|
| | | public GoodsClass(String name, String picture, int orderby, long createtime) {
|
| | | public GoodsClass(Long id) {
|
| | | super();
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public GoodsClass(String name, String picture, Integer orderby, Long createtime) {
|
| | | super();
|
| | | this.name = name;
|
| | | this.picture = picture;
|
| | |
| | | this.createtime = createtime;
|
| | | }
|
| | |
|
| | | public GoodsClass() {
|
| | | }
|
| | |
|
| | | public GoodsClass(long id) {
|
| | | super();
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public long getId() {
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(long id) {
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | |
| | |
|
| | | public void setName(String name) {
|
| | | this.name = name;
|
| | | }
|
| | |
|
| | | public String getKey() {
|
| | | return key;
|
| | | }
|
| | |
|
| | | public void setKey(String key) {
|
| | | this.key = key;
|
| | | }
|
| | |
|
| | | public String getPicture() {
|
| | |
| | | this.url = url;
|
| | | }
|
| | |
|
| | | public int getOrderby() {
|
| | | public String getKey() {
|
| | | return key;
|
| | | }
|
| | |
|
| | | public void setKey(String key) {
|
| | | this.key = key;
|
| | | }
|
| | |
|
| | | public String getSearchParam() {
|
| | | return searchParam;
|
| | | }
|
| | |
|
| | | public void setSearchParam(String searchParam) {
|
| | | this.searchParam = searchParam;
|
| | | }
|
| | |
|
| | | public Integer getOrderby() {
|
| | | return orderby;
|
| | | }
|
| | |
|
| | | public void setOrderby(int orderby) {
|
| | | public void setOrderby(Integer orderby) {
|
| | | this.orderby = orderby;
|
| | | }
|
| | |
|
| | | public long getCreatetime() {
|
| | | public Long getCreatetime() {
|
| | | return createtime;
|
| | | }
|
| | |
|
| | | public void setCreatetime(long createtime) {
|
| | | public void setCreatetime(Long createtime) {
|
| | | this.createtime = createtime;
|
| | | }
|
| | |
|
| | |
| | | this.countClick = countClick;
|
| | | }
|
| | |
|
| | | public List<BusinessSystem> getSystemList() {
|
| | | return systemList;
|
| | | }
|
| | |
|
| | | public void setSystemList(List<BusinessSystem> systemList) {
|
| | | this.systemList = systemList;
|
| | | }
|
| | |
|
| | | public int getCountlabel() {
|
| | | return countlabel;
|
| | | }
|
| | |
| | | this.countlabel = countlabel;
|
| | | }
|
| | |
|
| | | public String getSearchParam() {
|
| | | return searchParam;
|
| | | public List<BusinessSystem> getSystemList() {
|
| | | return systemList;
|
| | | }
|
| | |
|
| | | public void setSearchParam(String searchParam) {
|
| | | this.searchParam = searchParam;
|
| | | public void setSystemList(List<BusinessSystem> systemList) {
|
| | | this.systemList = systemList;
|
| | | }
|
| | |
|
| | | |
| | | }
|
| | |
| | | package com.yeshi.fanli.entity.bus.clazz;
|
| | |
|
| | | import javax.persistence.Column;
|
| | | import javax.persistence.Entity;
|
| | | import javax.persistence.FetchType;
|
| | | import javax.persistence.GeneratedValue;
|
| | | import javax.persistence.GenerationType;
|
| | | import javax.persistence.Id;
|
| | | import javax.persistence.JoinColumn;
|
| | | import javax.persistence.ManyToOne;
|
| | | import javax.persistence.Table;
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Entity
|
| | | @Table(name = "yeshi_ec_second_class")
|
| | | @Table("yeshi_ec_second_class")
|
| | | public class GoodsSecondClass {
|
| | | @Id
|
| | | @GeneratedValue(strategy = GenerationType.AUTO)
|
| | | |
| | | @Expose
|
| | | @Column(name = "id")
|
| | | private Long id;
|
| | | |
| | | @Expose
|
| | | private long id;
|
| | | @Expose
|
| | | @Column(name = "`name`", length = 50)
|
| | | @Column(name = "name")
|
| | | private String name;
|
| | | |
| | | @Expose
|
| | | @Column(name = "`picture`", length = 1024)
|
| | | @Column(name = "picture")
|
| | | private String picture;
|
| | | private int orderby;
|
| | | private long createtime;
|
| | | @ManyToOne(fetch = FetchType.EAGER)
|
| | | @JoinColumn(name = "pid")
|
| | | |
| | | @Column(name = "pid")
|
| | | private GoodsClass parent;
|
| | | @Column(name = "`key`", length = 10)
|
| | | |
| | | @Column(name = "key")
|
| | | private String key;
|
| | | |
| | | @Column(name = "orderby")
|
| | | private Integer orderby;
|
| | |
|
| | | @Column(name = "createtime")
|
| | | private Long createtime;
|
| | |
|
| | | public GoodsSecondClass() {
|
| | | }
|
| | |
| | | this.createtime = createtime;
|
| | | this.parent = parent;
|
| | | }
|
| | | |
| | | public String getKey() {
|
| | | return key;
|
| | | }
|
| | |
|
| | | public void setKey(String key) {
|
| | | this.key = key;
|
| | | }
|
| | |
|
| | | public GoodsClass getParent() {
|
| | | return parent;
|
| | | }
|
| | |
|
| | | public void setParent(GoodsClass parent) {
|
| | | this.parent = parent;
|
| | | }
|
| | |
|
| | | public long getId() {
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(long id) {
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | |
| | | this.picture = picture;
|
| | | }
|
| | |
|
| | | public int getOrderby() {
|
| | | public GoodsClass getParent() {
|
| | | return parent;
|
| | | }
|
| | |
|
| | | public void setParent(GoodsClass parent) {
|
| | | this.parent = parent;
|
| | | }
|
| | |
|
| | | public String getKey() {
|
| | | return key;
|
| | | }
|
| | |
|
| | | public void setKey(String key) {
|
| | | this.key = key;
|
| | | }
|
| | |
|
| | | public Integer getOrderby() {
|
| | | return orderby;
|
| | | }
|
| | |
|
| | | public void setOrderby(int orderby) {
|
| | | public void setOrderby(Integer orderby) {
|
| | | this.orderby = orderby;
|
| | | }
|
| | |
|
| | | public long getCreatetime() {
|
| | | public Long getCreatetime() {
|
| | | return createtime;
|
| | | }
|
| | |
|
| | | public void setCreatetime(long createtime) {
|
| | | public void setCreatetime(Long createtime) {
|
| | | this.createtime = createtime;
|
| | | }
|
| | | |
| | | }
|
| | |
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.persistence.Column;
|
| | | import javax.persistence.Entity;
|
| | | import javax.persistence.FetchType;
|
| | | import javax.persistence.GeneratedValue;
|
| | | import javax.persistence.GenerationType;
|
| | | import javax.persistence.Id;
|
| | | import javax.persistence.JoinColumn;
|
| | | import javax.persistence.ManyToOne;
|
| | | import javax.persistence.Table;
|
| | | import javax.persistence.Transient;
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Entity
|
| | | @Table(name = "yeshi_ec_sub_class")
|
| | | @org.yeshi.utils.mybatis.Table("yeshi_ec_sub_class")
|
| | | public class GoodsSubClass implements Serializable{
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | @Table("yeshi_ec_sub_class")
|
| | | public class GoodsSubClass implements Serializable {
|
| | |
|
| | | @Id
|
| | | @Expose
|
| | | @Column(name = "sub_id")
|
| | | @GeneratedValue(strategy = GenerationType.AUTO)
|
| | | @org.yeshi.utils.mybatis.Column(name="sub_id")
|
| | | private Long id;
|
| | |
|
| | | @Expose
|
| | | @Column(name = "sub_name")
|
| | | @org.yeshi.utils.mybatis.Column(name="sub_name")
|
| | | private String name; // 名称
|
| | |
|
| | | @Expose
|
| | | @Column(name = "sub_picture")
|
| | | @org.yeshi.utils.mybatis.Column(name="sub_picture")
|
| | | private String picture; // 图片路径
|
| | |
|
| | | @Expose
|
| | | @Column(name = "sub_weight")
|
| | | @org.yeshi.utils.mybatis.Column(name="sub_weight")
|
| | | private Integer weight; // 权重-排序
|
| | |
|
| | | @Expose
|
| | | @Column(name = "sub_state")
|
| | | @org.yeshi.utils.mybatis.Column(name="sub_state")
|
| | | private Integer state; // 状态 1启用 0停用
|
| | |
|
| | | @ManyToOne(fetch = FetchType.EAGER)
|
| | | @JoinColumn(name = "sub_root_id")
|
| | | @org.yeshi.utils.mybatis.Column(name="sub_root_id")
|
| | | @Column(name = "sub_root_id")
|
| | | private GoodsClass rootClass; // 一级类别
|
| | |
|
| | | @ManyToOne(fetch = FetchType.EAGER)
|
| | | @JoinColumn(name = "sub_pid")
|
| | | @org.yeshi.utils.mybatis.Column(name="sub_pid")
|
| | | @Column(name = "sub_pid")
|
| | | private GoodsSubClass parent ; // 上级:对应的二级以下分类 用于3级、4级、5级
|
| | |
|
| | | |
| | | @Expose
|
| | | @Column(name = "sub_level")
|
| | | @org.yeshi.utils.mybatis.Column(name="sub_level")
|
| | | private Integer level; // 具体等级
|
| | |
|
| | | @Expose
|
| | | @Column(name = "sub_key")
|
| | | @org.yeshi.utils.mybatis.Column(name="sub_key")
|
| | | private String key; // 搜索关键词
|
| | |
|
| | |
|
| | | @Expose
|
| | | @Column(name = "sub_search_json")
|
| | | @org.yeshi.utils.mybatis.Column(name="sub_search_json")
|
| | | private String searchJson; // 搜索条件
|
| | |
|
| | | |
| | | @Expose
|
| | | @Column(name = "sub_ios_click")
|
| | | @org.yeshi.utils.mybatis.Column(name="sub_ios_click")
|
| | | private Long iosClick = 0l;
|
| | |
|
| | | @Expose
|
| | | @Column(name = "sub_android_click")
|
| | | @org.yeshi.utils.mybatis.Column(name="sub_android_click")
|
| | | private Long androidClick = 0l;
|
| | |
|
| | | @Expose
|
| | | @Column(name = "sub_createtime")
|
| | | @org.yeshi.utils.mybatis.Column(name="sub_createtime")
|
| | | private Date createtime; // 创建时间
|
| | |
|
| | | @Expose
|
| | | @Column(name = "sub_updatetime")
|
| | | @org.yeshi.utils.mybatis.Column(name="sub_updatetime")
|
| | | private Date updatetime; // 创建时间
|
| | |
|
| | | @Transient
|
| | | private Long CountClick = 0l; |
| | | @Transient // 关联标签数量
|
| | | |
| | | private Long countClick = 0l; |
| | | // 关联标签数量
|
| | | private int countlabel = 0;
|
| | |
|
| | | private String searchParam;
|
| | |
|
| | | public GoodsSubClass(){}
|
| | |
|
| | | public GoodsSubClass(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | |
|
| | | public Long getId() {
|
| | |
| | | this.androidClick = androidClick;
|
| | | }
|
| | |
|
| | | public Long getCountClick() {
|
| | | return CountClick;
|
| | | }
|
| | |
|
| | | public void setCountClick(Long countClick) {
|
| | | CountClick = countClick;
|
| | | }
|
| | |
|
| | | public Integer getLevel() {
|
| | | return level;
|
| | | }
|
| | |
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public String getSearchParam() {
|
| | | return searchParam;
|
| | | }
|
| | |
|
| | | public void setSearchParam(String searchParam) {
|
| | | this.searchParam = searchParam;
|
| | | }
|
| | |
|
| | | public Long getCountClick() {
|
| | | return countClick;
|
| | | }
|
| | |
|
| | | public void setCountClick(Long countClick) {
|
| | | this.countClick = countClick;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | 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.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | |
| | | * @author yj
|
| | | *
|
| | | */
|
| | | @Entity
|
| | | @Table(name = "yeshi_ec_taobao_class")
|
| | | @org.yeshi.utils.mybatis.Table("yeshi_ec_taobao_class")
|
| | | @Table("yeshi_ec_taobao_class")
|
| | | public class TaoBaoClass {
|
| | | @Id
|
| | | |
| | | @Expose
|
| | | @Column(name = "tc_id")
|
| | | @GeneratedValue(strategy = GenerationType.AUTO)
|
| | | @org.yeshi.utils.mybatis.Column(name="tc_id")
|
| | | private Long id;
|
| | |
|
| | | @Expose
|
| | | @Column(name = "tc_category_id")
|
| | | @org.yeshi.utils.mybatis.Column(name="tc_category_id")
|
| | | private Integer categoryId; // 分类id
|
| | |
|
| | | @Expose
|
| | | @Column(name = "tc_category_name")
|
| | | @org.yeshi.utils.mybatis.Column(name="tc_category_name")
|
| | | private String categoryName; // 淘宝分类名称
|
| | |
|
| | | @Expose
|
| | | @Column(name = "tc_parent_category_id")
|
| | | @org.yeshi.utils.mybatis.Column(name="tc_parent_category_id")
|
| | | private Integer parentCategoryId; // 上级淘宝分类id
|
| | |
|
| | | @Expose
|
| | | @Column(name = "tc_createtime")
|
| | | @org.yeshi.utils.mybatis.Column(name="tc_createtime")
|
| | | private Date createtime; // 创建时间
|
| | |
|
| | | @Expose
|
| | | @Column(name = "tc_updatetime")
|
| | | @org.yeshi.utils.mybatis.Column(name="tc_updatetime")
|
| | | private Date updatetime; // 更新时间
|
| | |
|
| | |
|
| | |
| | |
|
| | | 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.JoinColumn;
|
| | | import javax.persistence.Table;
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.google.gson.annotations.Expose;
|
| | |
|
| | |
| | | * @author yj
|
| | | *
|
| | | */
|
| | | @Entity
|
| | | @Table(name = "yeshi_ec_taobao_class_mapper")
|
| | | @org.yeshi.utils.mybatis.Table("yeshi_ec_taobao_class_mapper")
|
| | | @Table("yeshi_ec_taobao_class_mapper")
|
| | | public class TaoBaoClassRelation {
|
| | | @Id
|
| | | |
| | | @Expose
|
| | | @Column(name = "tm_id")
|
| | | @GeneratedValue(strategy = GenerationType.AUTO)
|
| | | @org.yeshi.utils.mybatis.Column(name="tm_id")
|
| | | private Long id;
|
| | |
|
| | | @Expose
|
| | | @Column(name = "tm_system_cid")
|
| | | @org.yeshi.utils.mybatis.Column(name="tm_system_cid")
|
| | | private Long cid; // 本系统一级类目id
|
| | |
|
| | | @Expose
|
| | | @Column(name = "tm_system_sub_cid")
|
| | | @org.yeshi.utils.mybatis.Column(name="tm_system_sub_cid")
|
| | | private Long subId; //本系统二级类目id
|
| | |
|
| | | @Expose
|
| | | @Column(name = "tm_taobao_cid")
|
| | | @org.yeshi.utils.mybatis.Column(name="tm_taobao_cid")
|
| | | private Long taobaoCid; // 淘宝类目id
|
| | |
|
| | | @JoinColumn(name = "tm_weight")
|
| | | @org.yeshi.utils.mybatis.Column(name = "tm_weight")
|
| | | @Column(name = "tm_weight")
|
| | | private Double weight; // 权重
|
| | |
|
| | | @JoinColumn(name = "tm_createtime")
|
| | | @org.yeshi.utils.mybatis.Column(name = "tm_createtime")
|
| | | @Column(name = "tm_createtime")
|
| | | private Date createtime; // 创建时间
|
| | |
|
| | | @JoinColumn(name = "tm_updatetime")
|
| | | @org.yeshi.utils.mybatis.Column(name = "tm_updatetime")
|
| | | @Column(name = "tm_updatetime")
|
| | | private Date updatetime; // 更新时间(修改时间)
|
| | |
|
| | |
|
| | |
| | |
|
| | | import java.io.Serializable;
|
| | |
|
| | | import javax.persistence.Column;
|
| | | import javax.persistence.Entity;
|
| | | import javax.persistence.FetchType;
|
| | | import javax.persistence.GeneratedValue;
|
| | | import javax.persistence.GenerationType;
|
| | | import javax.persistence.Id;
|
| | | import javax.persistence.JoinColumn;
|
| | | import javax.persistence.ManyToOne;
|
| | | import javax.persistence.Table;
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | |
|
| | |
| | | *
|
| | | * @date 2018年10月24日
|
| | | */
|
| | | @Entity
|
| | | @Table(name = "yeshi_ec_super_homenavbar")
|
| | | @org.yeshi.utils.mybatis.Table("yeshi_ec_super_homenavbar")
|
| | | @Table("yeshi_ec_super_homenavbar")
|
| | | public class SuperHomeNavbar implements Serializable {
|
| | |
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | @Id
|
| | | @Column(name = "sp_id")
|
| | | @GeneratedValue(strategy = GenerationType.AUTO)
|
| | | @org.yeshi.utils.mybatis.Column(name = "sp_id")
|
| | | private Long id;
|
| | |
|
| | | // 导航栏id
|
| | | @ManyToOne(fetch = FetchType.EAGER)
|
| | | @JoinColumn(name = "sp_navbar_id")
|
| | | @org.yeshi.utils.mybatis.Column(name = "sp_navbar_id")
|
| | | @Column(name = "sp_navbar_id")
|
| | | private HomeNavbar homeNavbar;
|
| | |
|
| | | // 系统id
|
| | | @ManyToOne(fetch = FetchType.EAGER)
|
| | | @JoinColumn(name = "sp_system_id")
|
| | | @org.yeshi.utils.mybatis.Column(name = "sp_system_id")
|
| | | @Column(name = "sp_system_id")
|
| | | private BusinessSystem system;
|
| | |
|
| | | public Long getId() {
|
| | |
| | | package com.yeshi.fanli.entity.bus.lable;
|
| | |
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.springframework.format.annotation.DateTimeFormat;
|
| | |
| | | * @date 2018年8月2日
|
| | | */
|
| | | @Table("yeshi_ec_boutique_auto_rule")
|
| | | public class BoutiqueAutoRule { |
| | | public class BoutiqueAutoRule implements Serializable { |
| | | |
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | // 淘宝物料API
|
| | | public final static int TB_OPTIONAL = 1;
|
| | |
| | | package com.yeshi.fanli.entity.bus.lable;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | |
| | | * @date 2018年6月27日
|
| | | */
|
| | | @Table("yeshi_ec_label")
|
| | | public class Label {
|
| | | public class Label implements Serializable {
|
| | |
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | // 后台录入
|
| | | public final static int MODE_BACKSTAGE = 1;
|
| | | // excel导入
|
| | |
| | | package com.yeshi.fanli.entity.bus.lable;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.persistence.Column;
|
| | | import javax.persistence.Entity;
|
| | | import javax.persistence.FetchType;
|
| | | import javax.persistence.GeneratedValue;
|
| | | import javax.persistence.GenerationType;
|
| | | import javax.persistence.Id;
|
| | | import javax.persistence.JoinColumn;
|
| | | import javax.persistence.ManyToOne;
|
| | | import javax.persistence.Table;
|
| | |
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * 9k9组合类
|
| | |
| | | *
|
| | | * @date 2018年6月27日
|
| | | */
|
| | | @Entity
|
| | | @Table(name = "yeshi_ec_class_9k9")
|
| | | @org.yeshi.utils.mybatis.Table("yeshi_ec_class_9k9")
|
| | | public class MergeClass implements Serializable{
|
| | | @Table("yeshi_ec_class_9k9")
|
| | | public class MergeClass {
|
| | |
|
| | |
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | @Id
|
| | | @Column(name = "k_id")
|
| | | @GeneratedValue(strategy = GenerationType.AUTO)
|
| | | @org.yeshi.utils.mybatis.Column(name = "k_id")
|
| | | private Long id;
|
| | |
|
| | | @JoinColumn(name = "k_name")
|
| | | @org.yeshi.utils.mybatis.Column(name = "k_name")
|
| | | @Column(name = "k_name")
|
| | | private String name;// 名称
|
| | |
|
| | | @JoinColumn(name = "k_merge_cid")
|
| | | @org.yeshi.utils.mybatis.Column(name = "k_merge_cid")
|
| | | @Column(name = "k_merge_cid")
|
| | | private String mergeCids; // 系统类id(逗号隔开)
|
| | |
|
| | | @JoinColumn(name = "k_weight")
|
| | | @org.yeshi.utils.mybatis.Column(name = "k_weight")
|
| | | @Column(name = "k_weight")
|
| | | private Double weight; // 权重
|
| | |
|
| | | @JoinColumn(name = "k_createtime")
|
| | | @org.yeshi.utils.mybatis.Column(name = "k_createtime")
|
| | | @Column(name = "k_createtime")
|
| | | private Date createtime; // 创建时间
|
| | |
|
| | | @JoinColumn(name = "k_updatetime")
|
| | | @org.yeshi.utils.mybatis.Column(name = "k_updatetime")
|
| | | @Column(name = "k_updatetime")
|
| | | private Date updatetime; // 更新时间(修改时间)
|
| | |
|
| | |
|
| | |
| | | package com.yeshi.fanli.entity.bus.lable;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | |
| | | * @date 2018年7月3日
|
| | | */
|
| | | @Table("yeshi_ec_quality_factory")
|
| | | public class QualityFactory {
|
| | | public class QualityFactory implements Serializable {
|
| | | |
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | // 人工筛选入库
|
| | | public final static int MODE_MANUAL = 1;
|
| | |
| | | package com.yeshi.fanli.entity.bus.lable;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | |
| | | * @date 2018年9月18日
|
| | | */
|
| | | @Table("yeshi_ec_quality_flash_sale")
|
| | | public class QualityFlashSale {
|
| | | public class QualityFlashSale implements Serializable{
|
| | |
|
| | |
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | |
|
| | | @Column(name = "fs_id")
|
| | | private Long id;
|
| | |
|
| | |
| | | package com.yeshi.fanli.entity.bus.su.clazz;
|
| | |
|
| | | import java.io.Serializable;
|
| | |
|
| | | import javax.persistence.Column;
|
| | | import javax.persistence.Entity;
|
| | | import javax.persistence.FetchType;
|
| | | import javax.persistence.GeneratedValue;
|
| | | import javax.persistence.GenerationType;
|
| | | import javax.persistence.Id;
|
| | | import javax.persistence.JoinColumn;
|
| | | import javax.persistence.ManyToOne;
|
| | | import javax.persistence.Table;
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | |
|
| | | @Entity
|
| | | @Table(name = "yeshi_ec_super_goodsclass")
|
| | | public class SuperGoodsClass implements Serializable{
|
| | | /**
|
| | | * |
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | |
| | | @Id
|
| | | @GeneratedValue(strategy = GenerationType.AUTO)
|
| | | @Table("yeshi_ec_super_goodsclass")
|
| | | public class SuperGoodsClass {
|
| | |
|
| | | @Column(name = "id")
|
| | | private long id;
|
| | | @ManyToOne(fetch = FetchType.EAGER)
|
| | | @JoinColumn(name = "goodsclass_id")
|
| | | private Long id;
|
| | | |
| | | @Column(name = "goodsclass_id")
|
| | | private GoodsClass goodsClass;
|
| | | @ManyToOne(fetch = FetchType.EAGER)
|
| | | @JoinColumn(name = "system_id")
|
| | | |
| | | @Column(name = "system_id")
|
| | | private BusinessSystem system;
|
| | | |
| | | |
| | |
|
| | | public SuperGoodsClass() {
|
| | | }
|
| | | |
| | |
|
| | | public SuperGoodsClass(GoodsClass goodsClass, BusinessSystem system) {
|
| | | super();
|
| | | this.goodsClass = goodsClass;
|
| | | this.system = system;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | public long getId() {
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(long id) {
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.exception; |
| | | |
| | | public class GoodsClassException extends Exception { |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | private int code; |
| | | private String msg; |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public GoodsClassException(int code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public GoodsClassException() { |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return this.msg; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.exception; |
| | | |
| | | public class GoodsSubClassException extends Exception { |
| | | /** |
| | | * |
| | | */ |
| | | private static final long serialVersionUID = 1L; |
| | | private int code; |
| | | private String msg; |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public GoodsSubClassException(int code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public GoodsSubClassException() { |
| | | } |
| | | |
| | | @Override |
| | | public String getMessage() { |
| | | return this.msg; |
| | | } |
| | | |
| | | } |
| | |
| | | <?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" >
|
| | | <?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.GoodsClassMapper">
|
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.clazz.GoodsClass">
|
| | | <id column="id" property="id" jdbcType="BIGINT"/>
|
| | | <result column="name" property="name" jdbcType="VARCHAR"/>
|
| | | <result column="picture" property="picture" jdbcType="VARCHAR"/>
|
| | | <result column="orderby" property="orderby" jdbcType="INTEGER"/>
|
| | | <result column="createtime" property="createtime" jdbcType="TIMESTAMP"/>
|
| | | <result column="url" property="url" jdbcType="VARCHAR"/>
|
| | | <result column="key" property="key" jdbcType="VARCHAR"/>
|
| | | <result column="ios_click" property="iosClick" jdbcType="BIGINT"/>
|
| | | <result column="android_click" property="androidClick" jdbcType="BIGINT"/>
|
| | | </resultMap>
|
| | | |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass">
|
| | | update yeshi_ec_class
|
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.clazz.GoodsClass">
|
| | | <id column="id" property="id" jdbcType="BIGINT"/>
|
| | | <result column="name" property="name" jdbcType="VARCHAR"/>
|
| | | <result column="picture" property="picture" jdbcType="VARCHAR"/>
|
| | | <result column="url" property="url" jdbcType="VARCHAR"/>
|
| | | <result column="key" property="key" jdbcType="VARCHAR"/>
|
| | | <result column="search_param" property="searchParam" jdbcType="VARCHAR"/>
|
| | | <result column="orderby" property="orderby" jdbcType="INTEGER"/>
|
| | | <result column="createtime" property="createtime" jdbcType="BIGINT"/>
|
| | | <result column="ios_click" property="iosClick" jdbcType="BIGINT"/>
|
| | | <result column="android_click" property="androidClick" jdbcType="BIGINT"/>
|
| | | </resultMap>
|
| | | |
| | | <sql id="Base_Column_List">id,`name`,picture,`key`,search_param,orderby,createtime,ios_click,android_click</sql>
|
| | | |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
|
| | | select * from yeshi_ec_class where id = #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_class where id = #{id,jdbcType=BIGINT}</delete>
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_class (id,`name`,picture,url,`key`,search_param,orderby,createtime,ios_click,android_click) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{url,jdbcType=VARCHAR},#{key,jdbcType=VARCHAR},#{searchParam,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{createtime,jdbcType=BIGINT},#{iosClick,jdbcType=BIGINT},#{androidClick,jdbcType=BIGINT})</insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_class
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">id,</if>
|
| | | <if test="name != null">`name`,</if>
|
| | | <if test="picture != null">picture,</if>
|
| | | <if test="url != null">url,</if>
|
| | | <if test="key != null">`key`,</if>
|
| | | <if test="searchParam != null">search_param,</if>
|
| | | <if test="orderby != null">orderby,</if>
|
| | | <if test="createtime != null">createtime,</if>
|
| | | <if test="iosClick != null">ios_click,</if>
|
| | | <if test="androidClick != null">android_click,</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="picture != null">#{picture,jdbcType=VARCHAR},</if>
|
| | | <if test="url != null">#{url,jdbcType=VARCHAR},</if>
|
| | | <if test="key != null">#{key,jdbcType=VARCHAR},</if>
|
| | | <if test="searchParam != null">#{searchParam,jdbcType=VARCHAR},</if>
|
| | | <if test="orderby != null">#{orderby,jdbcType=INTEGER},</if>
|
| | | <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if>
|
| | | <if test="iosClick != null">#{iosClick,jdbcType=BIGINT},</if>
|
| | | <if test="androidClick != null">#{androidClick,jdbcType=BIGINT},</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass">update yeshi_ec_class set `name` = #{name,jdbcType=VARCHAR},picture = #{picture,jdbcType=VARCHAR},url = #{url,jdbcType=VARCHAR},`key` = #{key,jdbcType=VARCHAR},search_param = #{searchParam,jdbcType=VARCHAR},orderby = #{orderby,jdbcType=INTEGER},createtime = #{createtime,jdbcType=BIGINT},ios_click = #{iosClick,jdbcType=BIGINT},android_click = #{androidClick,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}</update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsClass">update yeshi_ec_class
|
| | | <set>
|
| | | <if test="name != null">`name`=#{name,jdbcType=VARCHAR},</if>
|
| | | <if test="picture != null">picture=#{picture,jdbcType=VARCHAR},</if>
|
| | | <if test="url != null">url=#{url,jdbcType=VARCHAR},</if>
|
| | | <if test="key != null">`key`=#{key,jdbcType=VARCHAR},</if>
|
| | | <if test="searchParam != null">search_param=#{searchParam,jdbcType=VARCHAR},</if>
|
| | | <if test="orderby != null">orderby=#{orderby,jdbcType=INTEGER},</if>
|
| | | <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if>
|
| | | <if test="iosClick != null">ios_click=#{iosClick,jdbcType=BIGINT},</if>
|
| | | <if test="androidClick != null">android_click=#{androidClick,jdbcType=BIGINT},</if>
|
| | | </set> where id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | <select id="getKwById" resultType="String">
|
| | | |
| | | |
| | | <select id="getKeysById" resultType="java.lang.String">
|
| | | SELECT ec.`key` FROM `yeshi_ec_class` ec WHERE ec.`id` = #{id};
|
| | | </select>
|
| | | |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
|
| | | select * from yeshi_ec_class where id = #{id,jdbcType=BIGINT}
|
| | | </select>
|
| | |
|
| | | <select id="listGoodsClassBySystemId" resultMap="BaseResultMap">
|
| | | SELECT c.id,c.name,c.picture,c.url FROM `yeshi_ec_class` c
|
| | |
| | | ORDER BY c.`orderby`
|
| | | </select>
|
| | |
|
| | | |
| | | </mapper> |
| | | <select id="getByAdjoinOrder" resultMap="BaseResultMap">
|
| | | SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_class fd |
| | | WHERE 1=1
|
| | | <if test="type == -1">
|
| | | AND fd.`orderby` <![CDATA[<]]> #{order} |
| | | ORDER BY fd.`orderby` desc
|
| | | </if>
|
| | | |
| | | <if test="type == 1">
|
| | | AND fd.`orderby` <![CDATA[>]]> #{order} |
| | | ORDER BY fd.`orderby` |
| | | </if>
|
| | | LIMIT 1
|
| | | </select>
|
| | | |
| | | |
| | | <select id="getGoodsClassAll" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_class rs ORDER BY rs.`orderby`
|
| | | </select>
|
| | | |
| | | <select id="listByName" resultMap="BaseResultMap">
|
| | | SELECT * from yeshi_ec_class rs |
| | | WHERE rs.name like '%#{name}%'
|
| | | LIMIT ${start},${count}
|
| | | </select>
|
| | | |
| | | <select id="countByName" resultType="java.lang.Integer">
|
| | | SELECT IFNULL(COUNT(rs.id),0) FROM yeshi_ec_class rs |
| | | <if test="systemId != null">
|
| | | RIGHT JOIN yeshi_ec_super_goodsclass sp ON sp.`goodsclass_id` = rs.`id` |
| | | </if>
|
| | | WHERE rs.name LIKE '%#{name}%' |
| | | <if test="systemId != null">
|
| | | AND sp.`system_id` = #{systemId}
|
| | | </if>
|
| | | </select>
|
| | | |
| | | <select id="getMaxOrder" resultType="java.lang.Integer">
|
| | | SELECT IFNULL(MAX(orderby),0) FROM `yeshi_ec_class`
|
| | | </select>
|
| | | </mapper>
|
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.GoodsSecondClassMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass"> |
| | | <id column="id" property="id" jdbcType="BIGINT"/> |
| | | <result column="name" property="name" jdbcType="VARCHAR"/> |
| | | <result column="picture" property="picture" jdbcType="VARCHAR"/> |
| | | <result column="key" property="key" jdbcType="VARCHAR"/> |
| | | <result column="orderby" property="orderby" jdbcType="INTEGER"/> |
| | | <result column="createtime" property="createtime" jdbcType="BIGINT"/> |
| | | |
| | | <association property="parent" column="pid" javaType="com.yeshi.fanli.entity.bus.clazz.GoodsClass"> |
| | | <id column="pid" property="id" jdbcType="BIGINT"/> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">id,name,picture,pid,key,orderby,createtime</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_second_class where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_second_class where id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_second_class (id,name,picture,pid,key,orderby,createtime) values (#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{parent.id,jdbcType=BIGINT},#{key,jdbcType=VARCHAR},#{orderby,jdbcType=INTEGER},#{createtime,jdbcType=BIGINT})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_second_class |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="name != null">name,</if> |
| | | <if test="picture != null">picture,</if> |
| | | <if test="parent != null">pid,</if> |
| | | <if test="key != null">key,</if> |
| | | <if test="orderby != null">orderby,</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="picture != null">#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="parent != null">#{parent.id,jdbcType=BIGINT},</if> |
| | | <if test="key != null">#{key,jdbcType=VARCHAR},</if> |
| | | <if test="orderby != null">#{orderby,jdbcType=INTEGER},</if> |
| | | <if test="createtime != null">#{createtime,jdbcType=BIGINT},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass">update yeshi_ec_second_class set name = #{name,jdbcType=VARCHAR},picture = #{picture,jdbcType=VARCHAR},pid = #{parent.id,jdbcType=BIGINT},key = #{key,jdbcType=VARCHAR},orderby = #{orderby,jdbcType=INTEGER},createtime = #{createtime,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass">update yeshi_ec_second_class |
| | | <set> |
| | | <if test="name != null">name=#{name,jdbcType=VARCHAR},</if> |
| | | <if test="picture != null">picture=#{picture,jdbcType=VARCHAR},</if> |
| | | <if test="parent != null">pid=#{parent.id,jdbcType=BIGINT},</if> |
| | | <if test="key != null">key=#{key,jdbcType=VARCHAR},</if> |
| | | <if test="orderby != null">orderby=#{orderby,jdbcType=INTEGER},</if> |
| | | <if test="createtime != null">createtime=#{createtime,jdbcType=BIGINT},</if> |
| | | </set> where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="getByGoodsClassId" resultMap="BaseResultMap"> |
| | | SELECT * FROM `yeshi_ec_second_class` gc |
| | | WHERE gc.`pid` = #{pid} |
| | | ORDER BY gc.`orderby` |
| | | </select> |
| | | |
| | | <select id="getByNameAndGoodsClassId" resultMap="BaseResultMap"> |
| | | SELECT * FROM `yeshi_ec_second_class` gc |
| | | WHERE gc.`pid` = #{pid} AND gc.`name` like '%#{name}%' |
| | | ORDER BY gc.`orderby` |
| | | LIMIT #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="countByNameAndGoodsClassId" resultType="java.lang.Integer"> |
| | | SELECT IFNULL(COUNT(gc.`id`),0) FROM `yeshi_ec_second_class` gc |
| | | WHERE gc.`pid` = #{pid} AND gc.`name` like '%#{name}%' |
| | | </select> |
| | | </mapper> |
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.SuperGoodsClassMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass"> |
| | | <id column="id" property="id" jdbcType="BIGINT"/> |
| | | |
| | | <association property="goodsClass" column="goodsclass_id" |
| | | select="com.yeshi.fanli.dao.mybatis.GoodsClassMapper.selectByPrimaryKey"/> |
| | | |
| | | <association property="system" column="system_id" javaType="com.yeshi.fanli.entity.system.BusinessSystem"> |
| | | <id column="system_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">id,goodsclass_id,system_id</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_super_goodsclass where id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_super_goodsclass where id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_super_goodsclass (id,goodsclass_id,system_id) values (#{id,jdbcType=BIGINT},#{goodsClass.id,jdbcType=BIGINT},#{system.id,jdbcType=BIGINT})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_super_goodsclass |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="goodsClass != null">goodsclass_id,</if> |
| | | <if test="system != null">system_id,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="goodsClass != null">#{goodsClass.id,jdbcType=BIGINT},</if> |
| | | <if test="system != null">#{system.id,jdbcType=BIGINT},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass">update yeshi_ec_super_goodsclass set goodsclass_id = #{goodsClass.id,jdbcType=BIGINT},system_id = #{system.id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass">update yeshi_ec_super_goodsclass |
| | | <set> |
| | | <if test="goodsClass != null">goodsclass_id=#{goodsClass.id,jdbcType=BIGINT},</if> |
| | | <if test="system != null">system_id=#{system.id,jdbcType=BIGINT},</if> |
| | | </set> where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="listBySystemId" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_super_goodsclass sg |
| | | LEFT JOIN yeshi_ec_class cs ON cs.`id` = sg.`goodsclass_id` |
| | | WHERE sg.`system_id` = #{systemId} |
| | | ORDER BY cs.`orderby` |
| | | </select> |
| | | |
| | | <select id="listByGoodsclassIds" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_super_goodsclass sg |
| | | LEFT JOIN yeshi_ec_class cs ON cs.`id` = sg.`goodsclass_id` |
| | | WHERE cs.`id` IN |
| | | <foreach collection="list" index="index" item="item" open="(" separator="," close=")"> |
| | | #{item} |
| | | </foreach> |
| | | </select> |
| | | |
| | | <select id="listBySystemIdAmdClassName" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_super_goodsclass sg |
| | | LEFT JOIN yeshi_ec_class cs ON cs.`id` = sg.`goodsclass_id` |
| | | WHERE sg.`system_id` = #{systemId} AND cs.`name` LIKE '%#{name}%' |
| | | ORDER BY cs.`orderby` |
| | | LIMIT #{start},#{count} |
| | | </select> |
| | | |
| | | <delete id="deleteBySystemIdAndClassId"> |
| | | DELETE FROM yeshi_ec_super_goodsclass |
| | | WHERE `goodsclass_id` = #{goodsClassId} AND system_id = #{systemId} |
| | | </delete> |
| | | |
| | | <delete id="deleteByClassId"> |
| | | DELETE FROM yeshi_ec_super_goodsclass |
| | | WHERE `goodsclass_id` = #{goodsClassId} |
| | | </delete> |
| | | |
| | | </mapper> |
| | |
| | | <!-- 整个订单失效 --> |
| | | AND co.co_state_whole_order = 3 |
| | | </if> |
| | | <if test="orderState != null and orderState == 4"> |
| | | <!-- 已收货订单 --> |
| | | AND co.co_state = 2 |
| | | </if> |
| | | </sql> |
| | | |
| | | <sql id="SELECT_PARAM_ORDER_CREATE_TIME"> |
| | |
| | | package com.yeshi.fanli.service.impl.goods;
|
| | |
|
| | | import java.io.FileNotFoundException;
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.io.Serializable;
|
| | | import java.net.URLEncoder;
|
| | | import java.text.MessageFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Collection;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Properties;
|
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.transaction.Transactional;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | 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 org.springframework.web.multipart.MultipartFile;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.dao.goods.GoodsClassDao;
|
| | | import com.yeshi.fanli.dao.mybatis.GoodsClassMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.lable.LabelClassMapper;
|
| | | import com.yeshi.fanli.entity.admin.GoodsClassAdmin;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
|
| | | import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | | import com.yeshi.fanli.exception.GoodsClassException;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
|
| | | import com.yeshi.fanli.service.inter.goods.SuperGoodsClassService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelClassService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | |
|
| | | @Service
|
| | | public class GoodsClassServiceImpl implements GoodsClassService {
|
| | |
|
| | | @Resource
|
| | | private GoodsClassDao goodsClassDao;
|
| | |
|
| | | @Resource
|
| | | private BusinessSystemService businessSystemService;
|
| | |
| | | private SuperGoodsClassService superGoodsClassService;
|
| | |
|
| | | @Resource
|
| | | private GoodsSecondClassService goodsSecondClassService;
|
| | |
|
| | | @Resource
|
| | | private GoodsClassMapper goodsClassMapper;
|
| | | |
| | | @Resource
|
| | | private LabelClassMapper labelClassMapper;
|
| | | |
| | |
|
| | | @Resource
|
| | | private GoodsSubClassService goodsSubClassService;
|
| | |
|
| | | @Resource
|
| | | private LabelClassService labelClassService;
|
| | | |
| | |
|
| | | public GoodsClass getGoodsClass(long gcid) {
|
| | | return goodsClassDao.find(GoodsClass.class, gcid);
|
| | | public GoodsClass getGoodsClass(long id) {
|
| | | return goodsClassMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void deleteGoodsClass(final long id) {
|
| | | goodsClassDao.excute(new HibernateCallback() {
|
| | | public Object doInHibernate(Session session)
|
| | | throws HibernateException {
|
| | | Query query = session.createQuery("delete from GoodsClass where id = ? ");
|
| | | query.setParameter(0, id);
|
| | | query.executeUpdate();
|
| | | return null;
|
| | | }
|
| | | });
|
| | | public int updateByPrimaryKey(GoodsClass record) {
|
| | | return goodsClassMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @SuppressWarnings("unchecked")
|
| | | public List<GoodsClass> getByorderby(int orderby) {
|
| | | |
| | | List<GoodsClass> goodsClassList = (List<GoodsClass>) goodsClassDao.excute(new HibernateCallback<List<GoodsClass>>() {
|
| | | public List<GoodsClass> doInHibernate(Session session) throws HibernateException {
|
| | | Query query = session.createQuery(" from GoodsClass rs where rs.orderby = ? ");
|
| | | query.setParameter(0, orderby);
|
| | | return query.list();
|
| | | }
|
| | | });
|
| | | |
| | | return goodsClassList;
|
| | | public String getKeysById(Long id) {
|
| | | return goodsClassMapper.getKeysById(id);
|
| | | }
|
| | | |
| | | @Override
|
| | | public GoodsClass selectByPrimaryKey(Long gcid) {
|
| | | return goodsClassMapper.selectByPrimaryKey(gcid);
|
| | | }
|
| | | |
| | | @Override
|
| | | public int updateByPrimaryKeySelective(GoodsClass record) {
|
| | | return goodsClassMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | |
|
| | | @SuppressWarnings("unchecked")
|
| | | public List<GoodsClassAdmin> getGoodsClassAdmins(int index, String platform, String packages, String key) {
|
| | | final int strat = index * Constant.PAGE_SIZE;
|
| | | platform = Utils.getMap().get(platform);
|
| | | BusinessSystem system = businessSystemService.getBusinessSystem(platform, packages);
|
| | | List<GoodsClass> GoodsClassList = null;
|
| | | List<SuperGoodsClass> superGoodsClassList = null;
|
| | | Map<Long, GoodsClassAdmin> goodsClassAdminMap = new HashMap<Long, GoodsClassAdmin>();
|
| | | List<GoodsClassAdmin> goodsClassAdmin = new ArrayList<GoodsClassAdmin>();
|
| | | if (system == null) {
|
| | | final String likekey = "%" + key + "%";
|
| | | GoodsClassList = (List<GoodsClass>) goodsClassDao.excute(new HibernateCallback<List<GoodsClass>>() {
|
| | | public List<GoodsClass> doInHibernate(Session session) throws HibernateException {
|
| | | Query query = session.createQuery(" from GoodsClass rs where rs.name like ? ");
|
| | | query.setFirstResult(strat);
|
| | | query.setMaxResults(Constant.PAGE_SIZE);
|
| | | query.setParameter(0, likekey);
|
| | | return query.list();
|
| | | }
|
| | | });
|
| | | List<Long> gcIdList = new ArrayList<Long>();
|
| | | for (GoodsClass rs : GoodsClassList) {
|
| | | gcIdList.add(rs.getId());
|
| | | }
|
| | | superGoodsClassList = superGoodsClassService.getSuperGoodsClasss(gcIdList);
|
| | | Map<Long, List<BusinessSystem>> superMap = new HashMap<Long, List<BusinessSystem>>();
|
| | | Long rsId = null;
|
| | | List<BusinessSystem> systemList = null;
|
| | | for (SuperGoodsClass srs : superGoodsClassList) {
|
| | | rsId = srs.getGoodsClass().getId();
|
| | | systemList = superMap.get(rsId);
|
| | | if (systemList == null) {
|
| | | systemList = new ArrayList<BusinessSystem>();
|
| | | }
|
| | | systemList.add(srs.getSystem());
|
| | | superMap.put(rsId, systemList);
|
| | | }
|
| | | GoodsClassAdmin rsa = null;
|
| | | for (GoodsClass GoodsClass : GoodsClassList) {
|
| | | long id = GoodsClass.getId();
|
| | | rsa = goodsClassAdminMap.get(id);
|
| | | if (rsa == null) {
|
| | | rsa = new GoodsClassAdmin();
|
| | | }
|
| | | List<BusinessSystem> list = superMap.get(id);
|
| | | if (list != null) {
|
| | | rsa.getSystemList().addAll(superMap.get(id));
|
| | | }
|
| | | rsa.setGoodsClass(GoodsClass);
|
| | | goodsClassAdminMap.put(id, rsa);
|
| | | }
|
| | | } else if (system != null) {
|
| | | String likekey = "%" + key + "%";
|
| | | superGoodsClassList = superGoodsClassService.getSuperGoodsClassList(system.getId(), strat,
|
| | | Constant.PAGE_SIZE, likekey);
|
| | | List<Long> gcIdList = new ArrayList<Long>();
|
| | | for (SuperGoodsClass superGoodsClass : superGoodsClassList) {
|
| | | GoodsClass GoodsClass = superGoodsClass.getGoodsClass();
|
| | | gcIdList.add(GoodsClass.getId());
|
| | | }
|
| | | superGoodsClassList = superGoodsClassService.getSuperGoodsClasss(gcIdList);
|
| | | GoodsClassAdmin rsa = null;
|
| | | for (SuperGoodsClass superGoodsClass : superGoodsClassList) {
|
| | | GoodsClass goodsClass = superGoodsClass.getGoodsClass();
|
| | | rsa = goodsClassAdminMap.get(goodsClass.getId());
|
| | | if (rsa == null) {
|
| | | rsa = new GoodsClassAdmin(goodsClass);
|
| | | }
|
| | | rsa.getSystemList().add(superGoodsClass.getSystem());
|
| | | goodsClassAdminMap.put(goodsClass.getId(), rsa);
|
| | | }
|
| | | }
|
| | | Map map = Utils.orderBy(goodsClassAdminMap);
|
| | | Collection<GoodsClassAdmin> values = map.values();
|
| | | goodsClassAdmin.addAll(values);
|
| | | return goodsClassAdmin;
|
| | |
|
| | | @Cacheable(value="classCache",key="'getGoodsClass-'+#gcid")
|
| | | @Override
|
| | | public GoodsClass getGoodsClassCache(long gcid) {
|
| | | return getGoodsClass(gcid);
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void deleteGoodsClass(long id) {
|
| | | goodsClassMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public int getCount(String platform, String packages, final String key) {
|
| | | |
| | | Long systemId = null;
|
| | | |
| | | platform = Utils.getMap().get(platform);
|
| | | final BusinessSystem system = businessSystemService.getBusinessSystem(platform, packages);
|
| | | return (Integer) goodsClassDao.excute(new HibernateCallback<Integer>() {
|
| | |
|
| | | public Integer doInHibernate(Session session) throws HibernateException {
|
| | | String k = "%" + key + "%";
|
| | | if (system == null) {
|
| | | // Query query = session.createSQLQuery("select
|
| | | // count(a.name) from (select `name` from yeshi_ec_class
|
| | | // where `name` like ?) a");
|
| | | Query query = session.createQuery("select count(gc.id) from GoodsClass gc where gc.name like ?");
|
| | | query.setParameter(0, k);
|
| | | Long result = (Long) query.uniqueResult();
|
| | | int intValue = result.intValue();
|
| | | return intValue;
|
| | | } else {
|
| | | // Query query =session.createSQLQuery("select count(a.name)
|
| | | // from (select hs.name from yeshi_ec_super_goodsclass shs
|
| | | // left join yeshi_ec_class hs on shs.goodsclass_id=hs.id
|
| | | // where shs.system_id=? and hs.name like ?) a");
|
| | | Query query = session.createQuery(
|
| | | "select count(sgc.id) from SuperGoodsClass sgc where sgc.goodsClass.name like ? and sgc.system.id=?");
|
| | | query.setParameter(0, k);
|
| | | query.setParameter(1, system.getId());
|
| | | Long result = (Long) query.uniqueResult();
|
| | | int intValue = result.intValue();
|
| | | return intValue;
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | // @Transactional
|
| | | // public void addGoodsClass(GoodsClass goodsClass) {
|
| | | // goodsClass.setCreatetime(java.lang.System.currentTimeMillis());
|
| | | // Serializable id = goodsClassDao.save(goodsClass);
|
| | | // Properties properties = new Properties();
|
| | | // InputStream in = null;
|
| | | // try {
|
| | | // in = new BufferedInputStream (new FileInputStream("url.properties"));
|
| | | // properties.load(in);
|
| | | // String url = (String) properties.get("url");
|
| | | // goodsClass.setUrl(url+id);
|
| | | // goodsClassDao.update(goodsClass);
|
| | | // } catch (FileNotFoundException e) {
|
| | | // e.printStackTrace();
|
| | | // } catch (IOException e) {
|
| | | // e.printStackTrace();
|
| | | // }finally{
|
| | | // if(in !=null){
|
| | | // try {
|
| | | // in.close();
|
| | | // } catch (IOException e) {
|
| | | // e.printStackTrace();
|
| | | // }
|
| | | // }
|
| | | // }
|
| | | // }
|
| | |
|
| | | public Integer addGoodsClass(final GoodsClass goodsClass) {
|
| | |
|
| | | return (Integer) goodsClassDao.excute(new HibernateCallback() {
|
| | |
|
| | | public Object doInHibernate(Session session) throws HibernateException {
|
| | | session.getTransaction().begin();
|
| | | goodsClass.setCreatetime(java.lang.System.currentTimeMillis());
|
| | | Serializable id = session.save(goodsClass);
|
| | | Properties properties = new Properties();
|
| | | InputStream in = null;
|
| | | try {
|
| | | in = this.getClass().getClassLoader().getResourceAsStream("url.properties");
|
| | | properties.load(in);
|
| | | String url = (String) properties.get("url");
|
| | | url = MessageFormat.format(url, id, goodsClass.getKey(), goodsClass.getName());
|
| | | goodsClass.setUrl(url);
|
| | | session.update(goodsClass);
|
| | | session.flush();
|
| | | session.getTransaction().commit();
|
| | | } catch (FileNotFoundException e) {
|
| | | session.getTransaction().rollback();
|
| | | e.printStackTrace();
|
| | | return 1;
|
| | | } catch (IOException e) {
|
| | | session.getTransaction().rollback();
|
| | | e.printStackTrace();
|
| | | return 2;
|
| | | } finally {
|
| | | if (in != null) {
|
| | | try {
|
| | | in.close();
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | |
| | | @Transactional
|
| | | public void deleteGoodsClasss(long[] gcids) {
|
| | | for (long id : gcids) {
|
| | | superGoodsClassService.deleteSuperGoodsClass(id);
|
| | | goodsSecondClassService.deleteSecondClassByGC(id);
|
| | | goodsClassDao.delete(new GoodsClass(id));
|
| | | |
| | | BusinessSystem system = businessSystemService.getBusinessSystem(platform, packages);
|
| | | if (system != null) {
|
| | | systemId = system.getId();
|
| | | }
|
| | | }
|
| | | |
| | | public Integer updateGoodsClass(final GoodsClass goodsClass) {
|
| | |
|
| | | return (Integer) goodsClassDao.excute(new HibernateCallback() {
|
| | |
|
| | | public Object doInHibernate(Session session) throws HibernateException {
|
| | | session.getTransaction().begin();
|
| | | goodsClass.setCreatetime(java.lang.System.currentTimeMillis());
|
| | | session.update(goodsClass);
|
| | | Properties properties = new Properties();
|
| | | InputStream in = null;
|
| | | try {
|
| | | in = this.getClass().getClassLoader().getResourceAsStream("url.properties");
|
| | | properties.load(in);
|
| | | String url = (String) properties.get("url");
|
| | | |
| | | java.lang.System.out.println(goodsClass.getKey());
|
| | | java.lang.System.out.println(goodsClass.getName());
|
| | | |
| | | String encodeKey = URLEncoder.encode(goodsClass.getKey(), "utf-8");
|
| | | String encodeName = URLEncoder.encode(goodsClass.getName(), "utf-8");
|
| | | url = MessageFormat.format(url, goodsClass.getId(), encodeKey, encodeName);
|
| | | goodsClass.setUrl(url);
|
| | | session.update(goodsClass);
|
| | | session.flush();
|
| | | session.getTransaction().commit();
|
| | | } catch (FileNotFoundException e) {
|
| | | session.getTransaction().rollback();
|
| | | e.printStackTrace();
|
| | | return 1;
|
| | | } catch (IOException e) {
|
| | | session.getTransaction().rollback();
|
| | | e.printStackTrace();
|
| | | return 2;
|
| | | } finally {
|
| | | if (in != null) {
|
| | | try {
|
| | | in.close();
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | return null;
|
| | | }
|
| | | });
|
| | | ;
|
| | | return goodsClassMapper.countByName(key, systemId);
|
| | | }
|
| | |
|
| | | @SuppressWarnings("unchecked")
|
| | |
|
| | | @Override
|
| | | public List<GoodsClass> queryAll(String platform, String packages) throws Exception{
|
| | |
|
| | |
| | |
|
| | | if (system == null) {
|
| | |
|
| | | goodsClassList = (List<GoodsClass>) goodsClassDao.excute(new HibernateCallback<List<GoodsClass>>() {
|
| | | public List<GoodsClass> doInHibernate(Session session) throws HibernateException {
|
| | | Query query = session.createQuery(" from GoodsClass order by orderby");
|
| | | return query.list();
|
| | | }
|
| | | });
|
| | | goodsClassList = goodsClassMapper.getGoodsClassAll();
|
| | |
|
| | | if (goodsClassList == null || goodsClassList.size() == 0) {
|
| | | return null;
|
| | |
| | | }
|
| | |
|
| | | } else if (system != null) {
|
| | | superGoodsClassList = superGoodsClassService.getSuperGoodsClassAll(system.getId());
|
| | | superGoodsClassList = superGoodsClassService.getSuperGoodsClassBySystemId(system.getId());
|
| | |
|
| | | if (goodsClassList == null || goodsClassList.size() == 0) {
|
| | | return null;
|
| | |
| | | } else {
|
| | | gclass.setCountClick(0l);
|
| | | }
|
| | | |
| | | String searchParam = gclass.getSearchParam();
|
| | | if (searchParam == null) {
|
| | | gclass.setSearchParam("");
|
| | | } else {
|
| | | gclass.setSearchParam(searchParam);
|
| | | }
|
| | | |
| | |
|
| | | int countlabel = labelClassMapper.getCountQueryByClassId(gclass.getId());
|
| | | int countlabel = labelClassService.getCountQueryByClassId(gclass.getId());
|
| | | gclass.setCountlabel(countlabel);
|
| | |
|
| | | List<Long> gList = new ArrayList<Long>();
|
| | |
| | | }
|
| | |
|
| | | public List<GoodsClass> getGoodsClassAll() {
|
| | | return goodsClassDao.list("from GoodsClass order by orderby");
|
| | | return goodsClassMapper.getGoodsClassAll();
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String getKwById(Long id) {
|
| | | return goodsClassMapper.getKwById(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public GoodsClass selectByPrimaryKey(Long gcid) {
|
| | | return goodsClassMapper.selectByPrimaryKey(gcid);
|
| | | }
|
| | | |
| | | @Override
|
| | | public int updateByPrimaryKeySelective(GoodsClass record) {
|
| | | return goodsClassMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | | |
| | | |
| | | |
| | | @Override
|
| | | public List<GoodsClass> queryAll() {
|
| | | return goodsClassMapper.queryAll();
|
| | | }
|
| | | |
| | | @Cacheable(value="classCache",key="'getGoodsClass-'+#gcid")
|
| | | @Override
|
| | | public GoodsClass getGoodsClassCache(long gcid) {
|
| | | return getGoodsClass(gcid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @SuppressWarnings("unchecked")
|
| | | public long saveAdd(GoodsClass record, MultipartFile file) throws Exception{
|
| | | public void saveObject(MultipartFile file, GoodsClass record) throws GoodsClassException, Exception{
|
| | |
|
| | | long result = 0; |
| | | record.setCreatetime(java.lang.System.currentTimeMillis());
|
| | | |
| | | /* 上传新图片 */
|
| | | if (file != null) {
|
| | | InputStream inputStream = file.getInputStream();
|
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | // 上传文件相对位置
|
| | | String fileUrl="ClassImg/"+UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | String uploadFilePath = COSManager.getInstance().uploadFile(inputStream, fileUrl).getUrl();
|
| | | |
| | | record.setPicture(uploadFilePath);
|
| | | String name = record.getName();
|
| | | if (name == null || name.trim().length() == 0) {
|
| | | throw new GoodsClassException(1, "分类名称不能为空");
|
| | | }
|
| | |
|
| | | addGoodsClass(record);
|
| | |
|
| | | record.setOrderby((int)record.getId());
|
| | | updateGoodsClass(record);
|
| | | // 图片上传
|
| | | String picture = null;
|
| | | if (file != null) {
|
| | | picture = uploadPicture(file);
|
| | | }
|
| | |
|
| | | long id = record.getId();
|
| | | if (id > 0) |
| | | return id;
|
| | | String params = record.getSearchParam();
|
| | | if (params== null || params.trim().length() == 0 || "null".equalsIgnoreCase(params)) {
|
| | | record.setSearchParam(null);
|
| | | } else {
|
| | | record.setSearchParam(params);
|
| | | }
|
| | |
|
| | | return result;
|
| | | |
| | | |
| | | Long id = record.getId();
|
| | | if (id == null) {
|
| | | record.setPicture(picture);
|
| | | record.setIosClick(0L);
|
| | | record.setAndroidClick(0L);
|
| | | |
| | | record.setCreatetime(java.lang.System.currentTimeMillis());
|
| | | |
| | | if (params== null || params.trim().length() == 0 || "null".equalsIgnoreCase(params)) {
|
| | | // 搜索条件:有券、在售价20-200、牛皮癣轻微
|
| | | record.setSearchParam("{\"quan\":1,\"endPrice\":220,\"includeGoodRate\":true,\"baoYou\":true,\"ip\":\"218.72.111.105\"}");
|
| | | }
|
| | | |
| | | // 排序
|
| | | int maxOrder = goodsClassMapper.getMaxOrder();
|
| | | record.setOrderby(maxOrder + 1);
|
| | | |
| | | goodsClassMapper.insert(record);
|
| | | |
| | | // 默认所有系统使用
|
| | | List<BusinessSystem> listSystems = businessSystemService.getBusinessSystems();
|
| | | if (listSystems != null && listSystems.size() > 0) {
|
| | | for(BusinessSystem businessSystem: listSystems) {
|
| | | SuperGoodsClass superGoodsClass = new SuperGoodsClass();
|
| | | superGoodsClass.setGoodsClass(record);;
|
| | | superGoodsClass.setSystem(businessSystem);
|
| | | superGoodsClassService.insertSelective(superGoodsClass);
|
| | | }
|
| | | }
|
| | | |
| | | } else {
|
| | | // 修改
|
| | | GoodsClass resultObj = goodsClassMapper.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | throw new GoodsClassException(1, "修改内容已不存在");
|
| | | }
|
| | | |
| | | if (picture != null && picture.trim().length() > 0) {
|
| | | // 删除老图
|
| | | removePicture(resultObj.getPicture());
|
| | | // 存储新图
|
| | | record.setPicture(picture);
|
| | | } else {
|
| | | record.setPicture(resultObj.getPicture());
|
| | | }
|
| | | |
| | | record.setIosClick(resultObj.getIosClick());
|
| | | record.setOrderby(resultObj.getOrderby());
|
| | | record.setAndroidClick(resultObj.getAndroidClick());
|
| | | record.setCreatetime(resultObj.getCreatetime());
|
| | | goodsClassMapper.updateByPrimaryKey(record);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 上传图片
|
| | | * @param file
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public String uploadPicture(MultipartFile file) throws Exception {
|
| | | |
| | | // 文件解析 |
| | | InputStream inputStream = file.getInputStream();
|
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | |
| | | // 文件路径
|
| | | String filePath="/img/GoodsClass/"+UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | // 执行上传
|
| | | String fileLink= COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
|
| | | |
| | | return fileLink;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除图片-不更新数据库
|
| | | * @param record
|
| | | * @throws Exception
|
| | | */
|
| | | public void removePicture(String picture) throws Exception {
|
| | | if (picture != null && picture.trim().length() > 0) {
|
| | | COSManager.getInstance().deleteFile(picture);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public void uploadPicture(GoodsClass record, MultipartFile file) throws Exception {
|
| | |
| | | /* 更新数据库信息 */
|
| | | if (!StringUtil.isNullOrEmpty(uploadFilePath)) {
|
| | | record.setPicture(uploadFilePath);
|
| | | updateGoodsClass(record);
|
| | | goodsClassMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | if (deleteFile) {
|
| | | record.setPicture(null);
|
| | | // 更新数据库
|
| | | updateGoodsClass(record);
|
| | | goodsClassMapper.updateByPrimaryKey(record);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | return list;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | @Transactional
|
| | | public void updateOrder(Long id, Integer moveType) throws GoodsClassException {
|
| | | |
| | | if (id == null || moveType == null || (!moveType.equals(1) && !moveType.equals(-1))) {
|
| | | throw new GoodsClassException(1, "请传递正确参数");
|
| | | }
|
| | | |
| | | GoodsClass resultObj = goodsClassMapper.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | throw new GoodsClassException(1, "此内容已不存在");
|
| | | }
|
| | | |
| | | Integer order = resultObj.getOrderby();
|
| | | // 获取交换对象
|
| | | GoodsClass exchangeObject = goodsClassMapper.getByAdjoinOrder( order, moveType);
|
| | | if (exchangeObject == null) {
|
| | | if (moveType == 1) {
|
| | | throw new GoodsClassException(1, "在相同使用地方中优先级已经最低了");
|
| | | } else {
|
| | | throw new GoodsClassException(1, "在相同使用地方中优先级已经最高了");
|
| | | }
|
| | | }
|
| | | |
| | | resultObj.setOrderby(exchangeObject.getOrderby());
|
| | | exchangeObject.setOrderby(order);
|
| | | |
| | | goodsClassMapper.updateByPrimaryKey(resultObj);
|
| | | goodsClassMapper.updateByPrimaryKey(exchangeObject);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.goods;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.hibernate.HibernateException;
|
| | | 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.goods.GoodsSecondClassDao;
|
| | | import com.yeshi.fanli.dao.mybatis.GoodsSecondClassMapper;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService;
|
| | |
| | | public class GoodsSecondClassServiceImpl implements GoodsSecondClassService {
|
| | |
|
| | | @Resource
|
| | | private GoodsSecondClassDao goodsSecondClassDao;
|
| | | private GoodsSecondClassMapper goodsSecondClassMapper;
|
| | | |
| | | |
| | | |
| | | @Cacheable(value="classCache",key="'getGoodsSecondClassByGoodsClassId-'+#id")
|
| | | public List<GoodsSecondClass> getGoodsSecondClassByGoodsClassId(long id) {
|
| | |
|
| | | List<GoodsSecondClass> list = goodsSecondClassDao.list(
|
| | | "from GoodsSecondClass gsc " + "where gsc.parent.id=? order by gsc.orderby ",
|
| | | new Serializable[] { id });
|
| | |
|
| | | return list;
|
| | | return goodsSecondClassMapper.getByGoodsClassId(id);
|
| | | }
|
| | |
|
| | | public List<GoodsSecondClass> getSecondClassList(int index, String key,
|
| | | long cid) {
|
| | |
|
| | | int start = index * Constant.PAGE_SIZE;
|
| | |
|
| | | List<GoodsSecondClass> list = goodsSecondClassDao
|
| | | .list("from GoodsSecondClass gsc where gsc.parent.id=? and gsc.name like ? order by gsc.orderby",
|
| | | start, Constant.PAGE_SIZE, new Serializable[] { cid,
|
| | | "%" + key + "%" });
|
| | |
|
| | | return list;
|
| | | public List<GoodsSecondClass> getSecondClassList(int index, String key, long cid) {
|
| | | return goodsSecondClassMapper.getByNameAndGoodsClassId(index * Constant.PAGE_SIZE, Constant.PAGE_SIZE, cid, key);
|
| | | }
|
| | |
|
| | | public int getCount(long cid, String key) {
|
| | | Long lcount = goodsSecondClassDao
|
| | | .getCount(
|
| | | "select count(*) from GoodsSecondClass gsc where gsc.parent.id=? and gsc.name like ? ",
|
| | | new Serializable[] { cid, "%" + key + "%" });
|
| | | return lcount.intValue();
|
| | | return goodsSecondClassMapper.countByNameAndGoodsClassId(cid, key);
|
| | | }
|
| | |
|
| | | public void addSecondClass(GoodsSecondClass secondClass) {
|
| | | secondClass.setCreatetime(System.currentTimeMillis());
|
| | | goodsSecondClassDao.save(secondClass);
|
| | | goodsSecondClassMapper.insert(secondClass);
|
| | | }
|
| | |
|
| | | public void deleteSecondClass(long sid) {
|
| | | goodsSecondClassDao.delete(new GoodsSecondClass(sid));
|
| | | goodsSecondClassMapper.deleteByPrimaryKey(sid);
|
| | | }
|
| | |
|
| | | public GoodsSecondClass getSecondClass(long scid) {
|
| | | return goodsSecondClassDao.find(GoodsSecondClass.class, scid);
|
| | | return goodsSecondClassMapper.selectByPrimaryKey(scid);
|
| | | }
|
| | |
|
| | | |
| | | public void updateSecondClass(GoodsSecondClass secondClass)
|
| | | throws NotExistObjectException {
|
| | | GoodsSecondClass find = goodsSecondClassDao.find(
|
| | | GoodsSecondClass.class, secondClass.getId());
|
| | | GoodsSecondClass find = goodsSecondClassMapper.selectByPrimaryKey(secondClass.getId());
|
| | | if (find == null) {
|
| | | throw new NotExistObjectException("不存在该用户");
|
| | | }
|
| | |
| | | find.setPicture(secondClass.getPicture());
|
| | | find.setOrderby(secondClass.getOrderby());
|
| | | find.setKey(secondClass.getKey());
|
| | | goodsSecondClassDao.update(find);
|
| | | }
|
| | |
|
| | | public void deleteSecondClassByGC(final long id) {
|
| | | goodsSecondClassDao.excute(new HibernateCallback() {
|
| | | public Object doInHibernate(Session session)
|
| | | throws HibernateException {
|
| | | session.createQuery(
|
| | | "delete from GoodsSecondClass gsc where gsc.parent.id=?")
|
| | | .setParameter(0, id).executeUpdate();
|
| | | return null;
|
| | | }
|
| | | });
|
| | | goodsSecondClassMapper.updateByPrimaryKey(find);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.goods;
|
| | |
|
| | | import java.io.InputStream;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.UUID;
|
| | |
|
| | |
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.GoodsSubClassMapper;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
|
| | | import com.yeshi.fanli.exception.GoodsSubClassException;
|
| | | import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
|
| | | import com.yeshi.fanli.service.inter.lable.LabelClassService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | @Service
|
| | | public class GoodsSubClassServiceImpl implements GoodsSubClassService {
|
| | |
| | | return goodsSubClassMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(GoodsSubClass record) {
|
| | | return goodsSubClassMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | |
| | | @Override
|
| | | @Transactional
|
| | | public void deleteSub(Long recordId) throws Exception {
|
| | | // TODO Auto-generated method stub
|
| | |
|
| | | GoodsSubClass goodsSubClass = goodsSubClassMapper.selectByPrimaryKey(recordId);
|
| | |
|
| | | if (goodsSubClass == null)
|
| | |
| | | goodsSubClassMapper.deleteByPrimaryKey(recordId);
|
| | | }
|
| | |
|
| | | |
| | | |
| | | @Override
|
| | | public int save(GoodsSubClass record, MultipartFile file) throws Exception {
|
| | |
|
| | | int result = 0;
|
| | |
|
| | | result = goodsSubClassMapper.insertSelective(record);
|
| | | public void saveObject(MultipartFile file, GoodsSubClass record, Integer type, Long pid) throws GoodsSubClassException, Exception{
|
| | |
|
| | |
|
| | | // 上传图片
|
| | | if (file != null) {
|
| | | result = goodsSubClassService.uploadPicture(record, file);
|
| | | String name = record.getName();
|
| | | if (name == null || name.trim().length() == 0) {
|
| | | throw new GoodsSubClassException(1, "分类名称不能为空");
|
| | | }
|
| | |
|
| | | return result;
|
| | | |
| | | // 图片上传
|
| | | String picture = null;
|
| | | if (file != null) {
|
| | | picture = uploadPicture(file);
|
| | | }
|
| | | |
| | | String params = record.getSearchParam();
|
| | | if (params== null || params.trim().length() == 0 || "null".equalsIgnoreCase(params)) {
|
| | | record.setSearchJson(null);
|
| | | } else {
|
| | | record.setSearchJson(params);
|
| | | }
|
| | | |
| | | Long id = record.getId();
|
| | | if (id == null) {
|
| | | if (type == null) {
|
| | | throw new GoodsSubClassException(1, "等级不能为空");
|
| | | }
|
| | | |
| | | if (type > 5) {
|
| | | throw new GoodsSubClassException(1, "等级不能超过五级");
|
| | | }
|
| | | |
| | | if (pid == null) {
|
| | | throw new GoodsSubClassException(1, "上级id为空");
|
| | | }
|
| | | |
| | | |
| | | if (type == 2) {
|
| | | record.setRootClass(new GoodsClass(pid));
|
| | | int weight = goodsSubClassMapper.getMaxWeightByRootId(pid);
|
| | | record.setWeight(weight + 1);
|
| | | } else {
|
| | | record.setParent(new GoodsSubClass(pid));
|
| | | int weight = goodsSubClassMapper.getMaxWeightByPid(pid);
|
| | | record.setWeight(weight + 1);
|
| | | }
|
| | | |
| | | String key = record.getKey();
|
| | | if (StringUtil.isNullOrEmpty(key)) {
|
| | | record.setKey(name.trim());
|
| | | }
|
| | | |
| | | record.setLevel(type);
|
| | | record.setPicture(picture);
|
| | | record.setState(0);
|
| | | record.setAndroidClick(0L);
|
| | | record.setIosClick(0L);
|
| | | record.setCreatetime(new Date());
|
| | | record.setUpdatetime(new Date());
|
| | | |
| | | if (params== null || params.trim().length() == 0 || "null".equalsIgnoreCase(params)) {
|
| | | // 搜索条件:有券、在售价20-200、牛皮癣轻微
|
| | | record.setSearchJson("{\"quan\":1,\"endPrice\":220,\"includeGoodRate\":true}");
|
| | | }
|
| | | |
| | | goodsSubClassMapper.insert(record);
|
| | | |
| | | } else {
|
| | | // 修改
|
| | | GoodsSubClass resultObj = goodsSubClassMapper.selectByPrimaryKey(id);
|
| | | if (resultObj == null) {
|
| | | throw new GoodsSubClassException(1, "修改内容已不存在");
|
| | | }
|
| | | |
| | | if (picture != null && picture.trim().length() > 0) {
|
| | | // 删除老图
|
| | | removePicture(resultObj.getPicture());
|
| | | // 存储新图
|
| | | record.setPicture(picture);
|
| | | } else {
|
| | | record.setPicture(resultObj.getPicture());
|
| | | }
|
| | | |
| | | record.setLevel(resultObj.getLevel());
|
| | | record.setRootClass(resultObj.getRootClass());
|
| | | record.setWeight(resultObj.getWeight());
|
| | | record.setIosClick(resultObj.getIosClick());
|
| | | record.setAndroidClick(resultObj.getAndroidClick());
|
| | | record.setCreatetime(resultObj.getCreatetime());
|
| | | record.setUpdatetime(new Date());
|
| | | goodsSubClassMapper.updateByPrimaryKey(record);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int uploadPicture(GoodsSubClass record, MultipartFile file) throws Exception {
|
| | |
|
| | | /**
|
| | | * 上传图片
|
| | | * @param file
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public String uploadPicture(MultipartFile file) throws Exception {
|
| | | |
| | | // 文件解析 |
| | | InputStream inputStream = file.getInputStream();
|
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | // 上传文件相对位置
|
| | | String fileUrl = "ClassImg/" + UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | |
|
| | | boolean deleteFile = true;
|
| | |
|
| | | /* 修改图片时,先删除已存在图片 */
|
| | | String picture = record.getPicture();
|
| | | if (!StringUtil.isNullOrEmpty(picture))
|
| | | deleteFile = COSManager.getInstance().deleteFile(picture);
|
| | |
|
| | | String uploadFilePath = null;
|
| | | /* 上传新图片 */
|
| | | if (deleteFile) {
|
| | | uploadFilePath = COSManager.getInstance().uploadFile(inputStream, fileUrl).getUrl();
|
| | | }
|
| | |
|
| | | /* 更新数据库信息 */
|
| | | int result = 0;
|
| | | if (!StringUtil.isNullOrEmpty(uploadFilePath)) {
|
| | | record.setPicture(uploadFilePath);
|
| | | result = goodsSubClassMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | | return result;
|
| | | |
| | | // 文件路径
|
| | | String filePath="/img/GoodsSubClass/"+UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | // 执行上传
|
| | | String fileLink= COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
|
| | | |
| | | return fileLink;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除图片
|
| | | * @param record
|
| | | * @throws Exception
|
| | | */
|
| | | public void removePicture(String picture) throws Exception {
|
| | | if (picture != null && picture.trim().length() > 0) {
|
| | | COSManager.getInstance().deleteFile(picture);
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 删除图片
|
| | |
| | | return goodsSubClassMapper.countByPid(pid);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计一级之下的所有二级分类最大权重
|
| | | * @param rootId 一级id
|
| | | * @returnL
|
| | | */
|
| | | @Override
|
| | | public int getMaxWeightByRootId(Long rootId) {
|
| | | return goodsSubClassMapper.getMaxWeightByRootId(rootId);
|
| | | }
|
| | | |
| | | /**
|
| | | * 统计二级分类之下其他分类最大权重
|
| | | * @param rootId 一级id
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public int getMaxWeightByPid(Long pid){
|
| | | return goodsSubClassMapper.getMaxWeightByPid(pid);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void countClick(AcceptData acceptData, GoodsSubClass record) {
|
| | |
| | | public List<GoodsSubClass> queryByListCid(List<Long> list){
|
| | | return goodsSubClassMapper.queryByListCid(list);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.impl.goods;
|
| | |
|
| | | import java.io.Serializable;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.hibernate.HibernateException;
|
| | | import org.hibernate.Query;
|
| | | import org.hibernate.Session;
|
| | | import org.hibernate.Transaction;
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | | import org.springframework.orm.hibernate4.HibernateCallback;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.goods.SuperGoodsClassDao;
|
| | | import com.yeshi.fanli.dao.mybatis.SuperGoodsClassMapper;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass;
|
| | | import com.yeshi.fanli.entity.system.BusinessSystem;
|
| | |
| | | public class SuperGoodsClassServiceImpl implements SuperGoodsClassService {
|
| | |
|
| | | @Resource
|
| | | private SuperGoodsClassDao superGoodsClassDao;
|
| | | private SuperGoodsClassMapper superGoodsClassMapper;
|
| | |
|
| | | @Resource
|
| | | private BusinessSystemService businessSystemService;
|
| | |
|
| | |
|
| | | @Override
|
| | | @Cacheable(value="classCache", key="'getSuperGoodsClassBySystemId-'+#id")
|
| | | public List<SuperGoodsClass> getSuperGoodsClassBySystemId(long id) {
|
| | | |
| | | return superGoodsClassDao.list("from SuperGoodsClass sgc where sgc.system.id=? order by sgc.goodsClass.orderby ", new Serializable[]{id});
|
| | | |
| | | return superGoodsClassMapper.listBySystemId(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<SuperGoodsClass> getSuperGoodsClasss(List<Long> gcIdList) {
|
| | | if (gcIdList.size() == 0) {
|
| | | if (gcIdList == null || gcIdList.size() == 0) {
|
| | | return new ArrayList<SuperGoodsClass>();
|
| | | }
|
| | | StringBuffer sb = new StringBuffer(" from SuperGoodsClass sgc ");
|
| | | Serializable[] serArr = new Serializable[gcIdList.size()];
|
| | | for (int i = 0; i < gcIdList.size(); i++) {
|
| | | if (i == 0) {
|
| | | sb.append(" where sgc.goodsClass.id=? ");
|
| | | } else {
|
| | | sb.append(" or sgc.goodsClass.id=? ");
|
| | | }
|
| | | serArr[i] = gcIdList.get(i);
|
| | | }
|
| | | //sb.append(" order by sgc.goodsClass.orderby ");
|
| | | String hql = sb.toString();
|
| | |
|
| | | return superGoodsClassDao.list(hql, serArr);
|
| | |
|
| | | return superGoodsClassMapper.listByGoodsclassIds(gcIdList);
|
| | | }
|
| | |
|
| | | public List<SuperGoodsClass> getSuperGoodsClassList(long id, int start,
|
| | | int count, String key) {
|
| | | return superGoodsClassDao.list("from SuperGoodsClass srs where srs.system.id=? and srs.goodsClass.name like ? order by sgc.goodsClass.orderby ",start,count,new Serializable[]{id, "%"+key+"%"});
|
| | | @Override
|
| | | public List<SuperGoodsClass> getSuperGoodsClassList(long id, int start, int count, String key) {
|
| | | return superGoodsClassMapper.listBySystemIdAmdClassName(start, count, key, id);
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<SuperGoodsClass> getSuperGoodsClassAll(long id) {
|
| | | return superGoodsClassDao.list("from SuperGoodsClass srs where srs.system.id=? order by sgc.goodsClass.orderby ",new Serializable[]{id});
|
| | | public Integer deleteSuperGoodsClass(final long gcid, final String platform, final String packageName) {
|
| | |
|
| | | BusinessSystem system = businessSystemService.getBusinessSystem(platform, packageName);
|
| | | if (system == null) {
|
| | | return 0;
|
| | | }
|
| | | return superGoodsClassMapper.deleteBySystemIdAndClassId(gcid, system.getId());
|
| | | }
|
| | |
|
| | | public Integer deleteSuperGoodsClass(final long gcid, final String platform,
|
| | | final String packageName) {
|
| | |
|
| | | return (Integer) superGoodsClassDao.excute(new HibernateCallback<Integer>() {
|
| | |
|
| | | public Integer doInHibernate(Session session)
|
| | | throws HibernateException {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystem(platform, packageName);
|
| | | Transaction transaction = session.beginTransaction();
|
| | | Query query = session.createQuery("delete SuperGoodsClass shs "
|
| | | + " where shs.goodsClass.id=? and shs.system.id=?");
|
| | | query.setLong(0, gcid);
|
| | | query.setLong(1, system.getId());
|
| | | int i = query.executeUpdate();
|
| | | transaction.commit();
|
| | | return i ;
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | public void addSuperGoodsClass(long gcid, String platform,
|
| | | String packageName) {
|
| | | |
| | | @Override
|
| | | public void addSuperGoodsClass(long gcid, String platform, String packageName) {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystem(platform,packageName);
|
| | | SuperGoodsClass superGoodsClass = new SuperGoodsClass();
|
| | | |
| | | GoodsClass goodsClass = new GoodsClass();
|
| | | goodsClass.setId(gcid);
|
| | | |
| | | SuperGoodsClass superGoodsClass = new SuperGoodsClass();
|
| | | superGoodsClass.setGoodsClass(goodsClass);;
|
| | | superGoodsClass.setSystem(system);
|
| | | superGoodsClassDao.create(superGoodsClass);
|
| | | superGoodsClassMapper.insert(superGoodsClass);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void deleteSuperGoodsClass(long gcid) {
|
| | | superGoodsClassMapper.deleteByClassId(gcid);
|
| | | }
|
| | |
|
| | | public void deleteSuperGoodsClass(final long gcid) {
|
| | | superGoodsClassDao.excute(new HibernateCallback() {
|
| | | public Object doInHibernate(Session session)
|
| | | throws HibernateException {
|
| | | Query query = session.createQuery("delete from SuperGoodsClass sgc where sgc.goodsClass.id=?");
|
| | | query.setParameter(0, gcid);
|
| | | query.executeUpdate();
|
| | | return null;
|
| | | }
|
| | | });
|
| | | |
| | | @Override
|
| | | public void insertSelective(SuperGoodsClass record){
|
| | | superGoodsClassMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | |
|
| | | |
| | | }
|
| | |
| | | }
|
| | |
|
| | | String params = record.getParams();
|
| | | if ((params != null && params.trim().length() == 0) || "null".equalsIgnoreCase(params) ) {
|
| | | if (params == null || params.trim().length() == 0 || "null".equalsIgnoreCase(params) ) {
|
| | | record.setParams(null);
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | String params = record.getParams();
|
| | | if ((params != null && params.trim().length() == 0) || "null".equalsIgnoreCase(params) ) {
|
| | | if (params == null || params.trim().length() == 0 || "null".equalsIgnoreCase(params) ) {
|
| | | record.setParams(null);
|
| | | }
|
| | |
|
| | |
| | | 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.util.Constant;
|
| | |
|
| | | @Service
|
| | |
| | | private AccountMessageMapper accountMessageMapper;
|
| | | @Resource
|
| | | private UserInfoDao userInfoDao;
|
| | | |
| | | @Resource
|
| | | private SystemZnxDao systemZnxDao;
|
| | | private SystemZnxService systemZnxService;
|
| | |
|
| | | @Override
|
| | | public List<AccountMessage> findAccountMessageList(long uid, int page) {
|
| | |
| | | UserInfo userInfo = userInfoDao.find(UserInfo.class, 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();
|
| | |
| | | userInfoVO.setLastLoginTime(null);
|
| | | }
|
| | |
|
| | | String wxUnionId = userInfoVO.getWxUnionId();
|
| | | if (wxUnionId == null || wxUnionId.trim().length() == 0) {
|
| | | userInfoVO.setWxName(null);
|
| | | }
|
| | | |
| | | String taoBaoUid = userInfoVO.getTaoBaoUid();
|
| | | if (taoBaoUid == null || taoBaoUid.trim().length() == 0) {
|
| | | userInfoVO.setTbName(null);
|
| | | }
|
| | | /* 显示用户微信 淘宝 老版本存在
|
| | | * String wxUnionId = userInfoVO.getWxUnionId(); if (wxUnionId == null ||
|
| | | * wxUnionId.trim().length() == 0) { userInfoVO.setWxName(null); }
|
| | | * |
| | | * String taoBaoUid = userInfoVO.getTaoBaoUid(); if (taoBaoUid == null ||
|
| | | * taoBaoUid.trim().length() == 0) { userInfoVO.setTbName(null); }
|
| | | */
|
| | |
|
| | |
|
| | | Long uid = userInfoVO.getId();
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.admin.GoodsClassAdmin;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.exception.GoodsClassException;
|
| | |
|
| | | public interface GoodsClassService {
|
| | |
|
| | |
| | |
|
| | | public GoodsClass getGoodsClassCache(long gcid);
|
| | |
|
| | | public List<GoodsClassAdmin> getGoodsClassAdmins(int i, String platform,
|
| | | String packages, String key);
|
| | |
|
| | | public int getCount(String platform, String packages, String key);
|
| | |
|
| | | public Integer addGoodsClass(GoodsClass goodsClass);
|
| | |
|
| | | public void deleteGoodsClasss(long[] gcids);
|
| | |
|
| | | public Integer updateGoodsClass(GoodsClass goodsClass);
|
| | | /**
|
| | | * 获取所有分类
|
| | | * @return
|
| | |
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | public String getKwById(Long id);
|
| | | public String getKeysById(Long id);
|
| | |
|
| | | /**
|
| | | * 上传图片
|
| | |
| | | */
|
| | | public void uploadPicture(GoodsClass record, MultipartFile file) throws Exception;
|
| | |
|
| | | /**
|
| | | * 新增类别
|
| | | * @param record
|
| | | * @param file
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public long saveAdd(GoodsClass record, MultipartFile file) throws Exception;
|
| | |
|
| | | public void deleteGoodsClass(long id);
|
| | |
|
| | |
| | |
|
| | | public List<GoodsClass> queryAll(String platform, String packages) throws Exception;
|
| | |
|
| | | /**
|
| | | * 根据排序id查询
|
| | | * @param orderby
|
| | | * @return
|
| | | */
|
| | | public List<GoodsClass> getByorderby(int orderby);
|
| | |
|
| | | |
| | | /**
|
| | | * 查询所有
|
| | | * @return
|
| | | */
|
| | | public List<GoodsClass> queryAll();
|
| | |
|
| | | /**
|
| | | * 选择性更新
|
| | |
| | | */
|
| | | public int updateByPrimaryKeySelective(GoodsClass record);
|
| | |
|
| | | |
| | | int updateByPrimaryKey(GoodsClass record);
|
| | | |
| | | |
| | | public GoodsClass selectByPrimaryKey(Long gcid);
|
| | |
|
| | |
|
| | |
| | | public List<Map<String, Object>> getClassListAllCache(Long systemId) throws Exception;
|
| | |
|
| | |
|
| | | /**
|
| | | * 保存分类信息
|
| | | * @param file
|
| | | * @param record
|
| | | * @throws GoodsClassException
|
| | | * @throws Exception
|
| | | */
|
| | | public void saveObject(MultipartFile file, GoodsClass record) throws GoodsClassException, Exception;
|
| | |
|
| | |
|
| | | /**
|
| | | * 后台顺序调整
|
| | | * @param id
|
| | | * @param moveType
|
| | | * @throws GoodsClassException
|
| | | */
|
| | | public void updateOrder(Long id, Integer moveType) throws GoodsClassException;
|
| | |
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | |
|
| | |
| | | public GoodsSecondClass getSecondClass(long scid);
|
| | |
|
| | | public void updateSecondClass(GoodsSecondClass secondClass) throws NotExistObjectException;
|
| | |
|
| | | public void deleteSecondClassByGC(long id);
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
|
| | | import com.yeshi.fanli.exception.GoodsSubClassException;
|
| | |
|
| | |
|
| | | public interface GoodsSubClassService {
|
| | |
| | |
|
| | | public int updateByPrimaryKeySelective(GoodsSubClass record);
|
| | |
|
| | | public int updateByPrimaryKey(GoodsSubClass record);
|
| | |
|
| | | /**
|
| | | * 批量删除
|
| | |
| | | */
|
| | | public void deleteByPrimaryKeyBatch(List<String> recordIds) throws Exception ;
|
| | |
|
| | | /**
|
| | | * 保存分类信息
|
| | | * @param record
|
| | | * @param file
|
| | | * @throws Exception
|
| | | */
|
| | | public int save(GoodsSubClass record, MultipartFile file) throws Exception;
|
| | |
|
| | | |
| | | /**
|
| | | * 上传图片文件 并更新对象信息
|
| | | * @param file |
| | | * @param record
|
| | | * @return
|
| | | * @throws Exception
|
| | | */
|
| | | public int uploadPicture(GoodsSubClass record, MultipartFile file) throws Exception;
|
| | | |
| | |
|
| | | /**
|
| | | * 删除图片文件 并更新对象信息
|
| | |
| | |
|
| | | public int countByPid(Long pid);
|
| | |
|
| | | /**
|
| | | * 统计一级之下的所有二级分类最大权重
|
| | | * @param rootId 一级id
|
| | | * @returnL
|
| | | */
|
| | | public int getMaxWeightByRootId(Long rootId);
|
| | |
|
| | | /**
|
| | | * 统计二级分类之下其他分类最大权重
|
| | | * @param rootId 一级id
|
| | | * @return
|
| | | */
|
| | | public int getMaxWeightByPid(Long pid);
|
| | |
|
| | | /**
|
| | | * 获取二级分类+ 加入缓存
|
| | |
| | | */
|
| | | public List<GoodsSubClass> queryByListCid(List<Long> list);
|
| | |
|
| | | /**
|
| | | * 保存分类信息
|
| | | * @param file
|
| | | * @param record
|
| | | * @param type
|
| | | * @param pid
|
| | | * @throws GoodsSubClassException
|
| | | * @throws Exception
|
| | | */
|
| | | public void saveObject(MultipartFile file, GoodsSubClass record, Integer type, Long pid)
|
| | | throws GoodsSubClassException, Exception;
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.cache.annotation.Cacheable;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass;
|
| | |
|
| | | public interface SuperGoodsClassService {
|
| | | |
| | |
|
| | | public List<SuperGoodsClass> getSuperGoodsClassBySystemId(long id);
|
| | |
|
| | | public List<SuperGoodsClass> getSuperGoodsClasss(List<Long> gcIdList);
|
| | |
|
| | | public List<SuperGoodsClass> getSuperGoodsClassList(long id, int strat,
|
| | | int pAGE_SIZE, String likekey);
|
| | | public List<SuperGoodsClass> getSuperGoodsClassList(long id, int strat, int pAGE_SIZE, String likekey);
|
| | |
|
| | | public Integer deleteSuperGoodsClass(long gcid, String platform,
|
| | | String packageName);
|
| | | public Integer deleteSuperGoodsClass(long gcid, String platform, String packageName);
|
| | |
|
| | | public void addSuperGoodsClass(long gcid, String platform,
|
| | | String packageName);
|
| | | public void addSuperGoodsClass(long gcid, String platform, String packageName);
|
| | |
|
| | | public void deleteSuperGoodsClass(long gcid);
|
| | |
|
| | | public List<SuperGoodsClass> getSuperGoodsClassAll(long id);
|
| | | public void insertSelective(SuperGoodsClass record);
|
| | |
|
| | | }
|
| | |
| | | int[] ids = new int[] { 1, 9, 10, 2, 3, 4, 5, 6, 7, 8 };
|
| | | for (int i = 0; i < names.length; i++) {
|
| | | GoodsClass gc = new GoodsClass();
|
| | | gc.setId(ids[i]);
|
| | | gc.setId(Long.parseLong(ids[i]+""));
|
| | | gc.setName(names[i]);
|
| | | list.add(gc);
|
| | | }
|