|
@@ -66,16 +66,8 @@ public class ProductController extends BaseController{
|
|
private BuyerProductHistoryPriceService buyerProductHistoryPriceService;
|
|
private BuyerProductHistoryPriceService buyerProductHistoryPriceService;
|
|
@Autowired
|
|
@Autowired
|
|
private ProductDao productDao;
|
|
private ProductDao productDao;
|
|
- @Resource
|
|
|
|
- private CmProductRecommendService cmProductRecommendService;
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private CmUserOrganizeService cmUserOrganizeService;
|
|
private CmUserOrganizeService cmUserOrganizeService;
|
|
- @Resource
|
|
|
|
- private ProductCustomClassificationService productCustomClassificationService;
|
|
|
|
- @Autowired
|
|
|
|
- private AreaService areaService;
|
|
|
|
- @Autowired
|
|
|
|
- private CmMallProductLadderPriceDao cmMallProductLadderPriceDao;
|
|
|
|
|
|
|
|
@ModelAttribute
|
|
@ModelAttribute
|
|
public Product get(@RequestParam(required=false) String id) {
|
|
public Product get(@RequestParam(required=false) String id) {
|
|
@@ -102,9 +94,7 @@ public class ProductController extends BaseController{
|
|
public String productPageMulti(Product product,String type,HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
public String productPageMulti(Product product,String type,HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
if(StringUtils.equals(type, "homeProduct")){
|
|
if(StringUtils.equals(type, "homeProduct")){
|
|
product.getSqlMap().put("dsf", " AND productID NOT IN (SELECT productID FROM crm_home_product b WHERE b.productId=a.productID) ");
|
|
product.getSqlMap().put("dsf", " AND productID NOT IN (SELECT productID FROM crm_home_product b WHERE b.productId=a.productID) ");
|
|
- }/*else if(StringUtils.equals(type, "smallType")){
|
|
|
|
- model.addAttribute("crmSmallTypeId", product.getCrmSmallTypeId());
|
|
|
|
- }*/
|
|
|
|
|
|
+ }
|
|
Page<Product> page = productService.findPage(new Page<Product>(request, response), product);
|
|
Page<Product> page = productService.findPage(new Page<Product>(request, response), product);
|
|
model.addAttribute("type", type);
|
|
model.addAttribute("type", type);
|
|
model.addAttribute("page", page);
|
|
model.addAttribute("page", page);
|
|
@@ -118,30 +108,7 @@ public class ProductController extends BaseController{
|
|
List<Product> list = page.getList();
|
|
List<Product> list = page.getList();
|
|
if(CollectionUtils.isNotEmpty(list)){
|
|
if(CollectionUtils.isNotEmpty(list)){
|
|
for(Product p :list){
|
|
for(Product p :list){
|
|
- String actFlag = p.getActFlag();
|
|
|
|
-// if(null != actFlag && StringUtils.equals("1",actFlag)){//活动商品
|
|
|
|
-// Date beginTime = p.getBeginTime();
|
|
|
|
-// Date endTime = p.getEndTime();
|
|
|
|
-// Date now = new Date();
|
|
|
|
-// //活动状态 1:即将开始 2:进行中 3:已结束
|
|
|
|
-// if(null != beginTime && null != endTime && (endTime.getTime() > beginTime.getTime() ) && (beginTime.getTime() > now.getTime())){//活动开始时间小于当前时间
|
|
|
|
-// // 即将开始
|
|
|
|
-// p.setActStatus("1");
|
|
|
|
-// }
|
|
|
|
-// if(null != beginTime && null != endTime && (now.getTime() > endTime.getTime()) && (endTime.getTime() > beginTime.getTime())) {//活动结束时间小于结束时间
|
|
|
|
-// // 已结束
|
|
|
|
-// p.setActStatus("3");
|
|
|
|
-// }
|
|
|
|
-// if(null != beginTime && null != endTime && (endTime.getTime() > now.getTime() ) && (beginTime.getTime() < now.getTime())) { //当前时间小于活动开始,小于活动结束时间
|
|
|
|
-// //进行中
|
|
|
|
-// p.setActStatus("2");
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
p.setMainImage(AppUtils.getImageURL("product", p.getMainImage(), 0, ""));
|
|
p.setMainImage(AppUtils.getImageURL("product", p.getMainImage(), 0, ""));
|
|
- //自定义分类
|
|
|
|
- List<ProductCustomClassification> typeList = productCustomClassificationService.findCustomClassification(Integer.valueOf(p.getId()));
|
|
|
|
- if (CollectionUtils.isNotEmpty(typeList))
|
|
|
|
- p.setCustomClass(true); // 有自定义分类
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -149,134 +116,6 @@ public class ProductController extends BaseController{
|
|
return "modules/product/productList";
|
|
return "modules/product/productList";
|
|
}
|
|
}
|
|
|
|
|
|
-/* @RequiresPermissions("product:product:view")
|
|
|
|
- @RequestMapping("activity/list")
|
|
|
|
- public String actlist(Product product, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
|
|
- Page<Product> page = productService.findActListPage(new Page<Product>(request, response), product);
|
|
|
|
- List<Product> list = page.getList();
|
|
|
|
- if(CollectionUtils.isNotEmpty(list)){
|
|
|
|
- for(Product p :list){
|
|
|
|
- String actStatus= p.getActStatus();
|
|
|
|
- if(null != actStatus && StringUtils.equals("1",actStatus)){//活动商品
|
|
|
|
- Date beginTime = p.getBeginTime();
|
|
|
|
- Date endTime = p.getEndTime();
|
|
|
|
- Date now = new Date();
|
|
|
|
- //活动状态 1:即将开始 2:进行中 3:已结束
|
|
|
|
- if(null != beginTime && null != endTime && (endTime.getTime() > beginTime.getTime() ) && (beginTime.getTime() > now.getTime())){//活动开始时间小于当前时间
|
|
|
|
- // 即将开始
|
|
|
|
- p.setActStatus("1");
|
|
|
|
- }
|
|
|
|
- if(null != beginTime && null != endTime && (now.getTime() > endTime.getTime()) && (endTime.getTime() > beginTime.getTime())) {//活动结束时间小于结束时间
|
|
|
|
- // 已结束
|
|
|
|
- p.setActStatus("3");
|
|
|
|
- }
|
|
|
|
- if(null != beginTime && null != endTime && (endTime.getTime() > now.getTime() ) && (beginTime.getTime() < now.getTime())) { //当前时间小于活动开始,小于活动结束时间
|
|
|
|
- //进行中
|
|
|
|
- p.setActStatus("2");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- p.setMainImage(AppUtils.getImageURL("product", p.getMainImage(), 0, ""));
|
|
|
|
- //自定义分类
|
|
|
|
- List<ProductCustomClassification> typeList = productCustomClassificationService.findCustomClassification(Integer.valueOf(p.getId()));
|
|
|
|
- if (CollectionUtils.isNotEmpty(typeList)) {
|
|
|
|
- p.setCustomClass(true); // 有自定义分类
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- model.addAttribute("page", page);
|
|
|
|
- return "modules/product/actList";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @RequiresPermissions("product:product:view")
|
|
|
|
- @RequestMapping("activity/addPage")
|
|
|
|
- public String addActPage(Product product, Model model) {
|
|
|
|
- model.addAttribute("product", product);
|
|
|
|
- return "modules/product/addActPage";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @RequestMapping(value = "activity/toAdd")
|
|
|
|
- public String toAddProduct3(Product product, Page page, Model model, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
- page = productService.findPage(new Page<Product>(request, response), product);
|
|
|
|
- model.addAttribute("page", page);
|
|
|
|
- return "modules/product/actSelectProduct";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value = "activity/saveTemp")
|
|
|
|
- public Map<String, Object> saveTemp() {
|
|
|
|
- Map<String, Object> map = Maps.newLinkedHashMap();
|
|
|
|
- map.put("success", true);
|
|
|
|
- map.put("msg", "添加成功");
|
|
|
|
- return map;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @RequiresPermissions("product:product:view")
|
|
|
|
- @RequestMapping("activity/saveAdd")
|
|
|
|
- public String addActProduct(Product product){
|
|
|
|
- try {
|
|
|
|
- Product actProduct = new Product();
|
|
|
|
- actProduct.setId(product.getId());
|
|
|
|
- actProduct.setProductID(product.getProductID());
|
|
|
|
- actProduct.setActStatus("1");
|
|
|
|
- actProduct.setActPrice1(product.getActPrice1());
|
|
|
|
- actProduct.setBeginTime(product.getBeginTime());
|
|
|
|
- actProduct.setEndTime(product.getEndTime());
|
|
|
|
- productDao.updateActive(actProduct);
|
|
|
|
- return "redirect:"+ Global.getAdminPath()+"/product/activity/list";
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- logger.debug(e.toString(), e);
|
|
|
|
- return "redirect:"+ Global.getAdminPath()+"/product/activity/addPage";
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @RequiresPermissions("product:product:view")
|
|
|
|
- @RequestMapping("activity/delete")
|
|
|
|
- public String addActProduct(Integer id){
|
|
|
|
- try {
|
|
|
|
- Product actProduct = new Product();
|
|
|
|
- actProduct.setId(id.toString());
|
|
|
|
- actProduct.setProductID(id);
|
|
|
|
- actProduct.setActStatus("0");
|
|
|
|
- *//*actProduct.setActPrice1(null);
|
|
|
|
- actProduct.setBeginTime(null);
|
|
|
|
- actProduct.setEndTime(null);*//*
|
|
|
|
- productDao.updateActive(actProduct);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- logger.debug(e.toString(), e);
|
|
|
|
- }
|
|
|
|
- return "redirect:"+ Global.getAdminPath()+"/product/activity/list";
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
- /*@ResponseBody
|
|
|
|
- @RequestMapping(value = {"/addPreferred"})
|
|
|
|
- public Map<String, Object> addPreferred(Integer productId, Integer preferredFlag) {
|
|
|
|
- Map<String, Object> map = Maps.newLinkedHashMap();
|
|
|
|
- try {
|
|
|
|
- Product product = new Product();
|
|
|
|
- product.setProductID(productId);
|
|
|
|
- product.setPreferredFlag(preferredFlag);
|
|
|
|
- productService.updatePreferred(product);
|
|
|
|
- map.put("success", true);
|
|
|
|
- map.put("msg", "操作成功");
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- logger.debug(e.toString(), e);
|
|
|
|
- map.put("success", false);
|
|
|
|
- map.put("msg", "操作失败");
|
|
|
|
- }
|
|
|
|
- return map;
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
- /*@RequestMapping(value = {"/preferredPage"})
|
|
|
|
- public String preferredPage(CmPageModules cmPageModules, Model model) {
|
|
|
|
- CmPageModules modules = cmUserOrganizeService.getCmPageModulesInfoByOrganizeID(cmPageModules.getOrganizeID(), null);
|
|
|
|
- //获取组织列表
|
|
|
|
- List<CmUserOrganize> cmUserOrganizeList = cmUserOrganizeService.findList(new CmUserOrganize());
|
|
|
|
- model.addAttribute("cmUserOrganizeList", cmUserOrganizeList);
|
|
|
|
- model.addAttribute("cmPageModules", modules);
|
|
|
|
- return "modules/applets/setHomePage";
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
@RequestMapping(value = "saveUserOrganizeModules")
|
|
@RequestMapping(value = "saveUserOrganizeModules")
|
|
public String saveUserOrganizeModules(CmPageModules cmPageModules, Model model, HttpServletRequest request, HttpServletResponse response) {
|
|
public String saveUserOrganizeModules(CmPageModules cmPageModules, Model model, HttpServletRequest request, HttpServletResponse response) {
|
|
Integer organizeID = cmPageModules.getOrganizeID();
|
|
Integer organizeID = cmPageModules.getOrganizeID();
|
|
@@ -322,38 +161,6 @@ public class ProductController extends BaseController{
|
|
return "redirect:"+ Global.getAdminPath()+"/product/new/list";
|
|
return "redirect:"+ Global.getAdminPath()+"/product/new/list";
|
|
}
|
|
}
|
|
|
|
|
|
-/* @RequiresPermissions("product:product:view")
|
|
|
|
- @RequestMapping(value = "productEdit")
|
|
|
|
- public String editProduct(Product product, Model model) {
|
|
|
|
- if( null != product.getProductID()){
|
|
|
|
- ProductDetailInfo productDetailInfo = productService.getProductDetailInfo(product.getProductID());
|
|
|
|
- List<ProductLadderPrice> ladderPriceList = productService.findLadderPrice(product.getProductID());
|
|
|
|
- if (null != productDetailInfo) {
|
|
|
|
- product.setDetailInfo(productDetailInfo.getDetailInfo());
|
|
|
|
- product.setServiceInfo(productDetailInfo.getServiceInfo());
|
|
|
|
- product.setOrderInfo(productDetailInfo.getOrderInfo());
|
|
|
|
- }
|
|
|
|
- product.setLadderPriceList(ladderPriceList);
|
|
|
|
- }
|
|
|
|
- List<CmBrand> brandList = productService.findBrandList();
|
|
|
|
- Map<String, Object> classify = productService.findClassify(1);
|
|
|
|
- List<Province> provinceList = areaService.loadProvince();
|
|
|
|
- model.addAttribute("brandList", brandList);
|
|
|
|
- model.addAttribute("classify", classify);
|
|
|
|
- model.addAttribute("provinceList", provinceList);
|
|
|
|
- model.addAttribute("product", product);
|
|
|
|
- return "modules/product/productEdit";
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
- /*@RequiresPermissions("product:product:edit")
|
|
|
|
- @RequestMapping(value = "productSave")
|
|
|
|
- public String productSave(Product product, ProductDetailInfo productDetailInfo, RedirectAttributes redirectAttributes) {
|
|
|
|
- productDetailInfo.setProductID(product.getProductID());
|
|
|
|
- productService.saveProduct(product, productDetailInfo);
|
|
|
|
- addMessage(redirectAttributes, "保存商品成功");
|
|
|
|
- return "redirect:" + Global.getAdminPath() + "/product/list/";
|
|
|
|
- }*/
|
|
|
|
-
|
|
|
|
@RequiresPermissions("product:product:view")
|
|
@RequiresPermissions("product:product:view")
|
|
@RequestMapping(value = "form")
|
|
@RequestMapping(value = "form")
|
|
public String form(Product product, Model model) {
|
|
public String form(Product product, Model model) {
|
|
@@ -731,30 +538,6 @@ public class ProductController extends BaseController{
|
|
return "modules/bulkpurchase/productRedPriceList";
|
|
return "modules/bulkpurchase/productRedPriceList";
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 商品参加活动
|
|
|
|
- * @param product
|
|
|
|
- * @param model
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @RequiresPermissions("product:product:view")
|
|
|
|
- @RequestMapping(value = "joinAct")
|
|
|
|
- public String joinAct(Product product, Model model) {
|
|
|
|
- model.addAttribute("product", product);
|
|
|
|
-// Date beginTime = product.getBeginTime();
|
|
|
|
-// Date endTime = product.getEndTime();
|
|
|
|
-// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
-// if(null != beginTime && null != endTime){
|
|
|
|
-// String beginTimeStr = sdf.format(beginTime);
|
|
|
|
-// String endTimeStr = sdf.format(endTime);
|
|
|
|
-// product.setBeginTimeStr(beginTimeStr);
|
|
|
|
-// product.setEndTimeStr(endTimeStr);
|
|
|
|
-// }
|
|
|
|
- List<ActType> actTypeList = productService.getAllActType();
|
|
|
|
- model.addAttribute("actTypeList", actTypeList);
|
|
|
|
- return "modules/product/productJoinActForm";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 取消商品参加活动 * @param product
|
|
* 取消商品参加活动 * @param product
|
|
* @return
|
|
* @return
|
|
@@ -984,338 +767,6 @@ public class ProductController extends BaseController{
|
|
return jsonModel;
|
|
return jsonModel;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
-// /**
|
|
|
|
-// * 参加{买赠,买送,满减}活动
|
|
|
|
-// * @param param 包含(活动类型:actType(1:满赠、2:买赠、3满减、4表示团购、5:热卖)、fullGiftProductId(参与活动商品ID))
|
|
|
|
-// * 开始时间beginTime 结束时间endTime 市1:满赠、2:买赠、3满减场价normalPrice 活动普通价actPrice0 活动会员价actPrice1 满金额fullAmount 减金额reduceAmount
|
|
|
|
-// * 满数量fullNumber 赠送商品giftProducts(格式[{"id":1,"num":80},{"id":2,"num":100}])
|
|
|
|
-// * @return
|
|
|
|
-// */
|
|
|
|
-// @ResponseBody
|
|
|
|
-// @RequestMapping("joinActivity")
|
|
|
|
-// public JsonModel joinActivity(String param) {
|
|
|
|
-// JsonModel jsonModel=new JsonModel();
|
|
|
|
-// if (com.caimei.utils.StringUtils.isBlank(param)) {
|
|
|
|
-// jsonModel.error(CodeMsg.PARAMETER_NULL_ERRO.getCode(), CodeMsg.PARAMETER_NULL_ERRO.getMsg());
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// Map<String, Object> map = Maps.newHashMap();
|
|
|
|
-// try {
|
|
|
|
-// map = (Map<String, Object>) JsonMapper.getInstance().fromJsonString(param, Map.class);
|
|
|
|
-// if (MapUtils.isEmpty(map)) {
|
|
|
|
-// jsonModel.error("参数不能为空");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// if(null==map.get("actType")|| StringUtils.isEmpty(String.valueOf(map.get("actType")))){
|
|
|
|
-// jsonModel.error("活动类型 参数为空");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// if(null==map.get("fullGiftProductId")|| StringUtils.isEmpty(String.valueOf(map.get("fullGiftProductId")))){
|
|
|
|
-// jsonModel.error("商品ID参数为空");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// if(null==map.get("beginTime") || StringUtils.isEmpty(String.valueOf(map.get("beginTime")))){
|
|
|
|
-// jsonModel.error("开始时间参数为空");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// if(null==map.get("endTime")|| StringUtils.isEmpty(String.valueOf(map.get("endTime")))){
|
|
|
|
-// jsonModel.error("结束时间参数为空");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// if(null==map.get("normalPrice")|| StringUtils.isEmpty(String.valueOf(map.get("normalPrice")))){
|
|
|
|
-// jsonModel.error("市场价参数为空");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// if(null==map.get("actPrice0")|| StringUtils.isEmpty(String.valueOf(map.get("actPrice0")))){
|
|
|
|
-// jsonModel.error("普通价参数为空");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// if(null==map.get("actPrice1") || StringUtils.isEmpty(String.valueOf(map.get("actPrice1")))){
|
|
|
|
-// jsonModel.error("会员价参数为空");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// Integer actType = (Integer)map.get("actType");
|
|
|
|
-// Integer fullGiftProductId = Integer.parseInt(map.get("fullGiftProductId").toString());
|
|
|
|
-//
|
|
|
|
-// SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
|
|
|
-// String start = map.get("beginTime") +" 00:00:00";
|
|
|
|
-// String end = map.get("endTime") +" 23:59:59";
|
|
|
|
-// Date beginTime=sdf.parse(start);
|
|
|
|
-// Date endTime=sdf.parse(end);
|
|
|
|
-// Float normalPrice = Float.parseFloat(map.get("normalPrice").toString());
|
|
|
|
-// Float actPrice0 = Float.parseFloat(map.get("actPrice0").toString());
|
|
|
|
-// Float actPrice1 = Float.parseFloat(map.get("actPrice1").toString());
|
|
|
|
-//
|
|
|
|
-// Product productInfo = productService.get(String.valueOf(fullGiftProductId));
|
|
|
|
-// if("1".equals(actType.toString())){//1满赠
|
|
|
|
-// Product product = productInfo;
|
|
|
|
-// if(null==map.get("fullAmount") || StringUtils.isEmpty(String.valueOf(map.get("fullAmount")))){
|
|
|
|
-// jsonModel.error("满含金额为空");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-//// Float fullAmount = Float.parseFloat(map.get("fullAmount").toString());
|
|
|
|
-//// product.setActFullGiftAmount(fullAmount);
|
|
|
|
-// //保存商品参加活动信息
|
|
|
|
-// saveJoinActivity(product,productInfo,actType,beginTime,endTime,normalPrice,actPrice0,actPrice1,fullGiftProductId);
|
|
|
|
-// //保存赠送商品信息
|
|
|
|
-// if (null == map.get("giftProducts") || StringUtils.isEmpty(String.valueOf(map.get("giftProducts")))) {
|
|
|
|
-// jsonModel.error("赠送商品不能为空");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// List<Map<String,Object>> products = (List<Map<String, Object>>) map.get("giftProducts");//需要赠送的商品
|
|
|
|
-// for (Map<String,Object> m:products) {
|
|
|
|
-// Integer giftProductId = Integer.parseInt(m.get("id").toString());
|
|
|
|
-// Integer giftProductNum = Integer.parseInt(m.get("num").toString());
|
|
|
|
-// jsonModel = savejoinProductGift(String.valueOf(actType), fullGiftProductId, giftProductId, giftProductNum);
|
|
|
|
-// if("1".equals(jsonModel.getErrcode())){
|
|
|
|
-// //存在异常
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }else if("2".equals(actType.toString())){//2买赠
|
|
|
|
-// Product product = productInfo;;
|
|
|
|
-// if(null==map.get("fullNumber") || StringUtils.isEmpty(String.valueOf(map.get("fullNumber")))){
|
|
|
|
-// jsonModel.error("满送数量为空");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// Integer fullNumber = Integer.parseInt(map.get("fullNumber").toString());
|
|
|
|
-// product.setActBuyGiftNum(fullNumber);
|
|
|
|
-// //保存商品参加活动信息
|
|
|
|
-// saveJoinActivity(product,productInfo,actType,beginTime,endTime,normalPrice,actPrice0,actPrice1,fullGiftProductId);
|
|
|
|
-// //保存赠送商品信息
|
|
|
|
-// if (null == map.get("giftProducts") || StringUtils.isEmpty(String.valueOf(map.get("giftProducts")))) {
|
|
|
|
-// jsonModel.error("赠送商品不能为空");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// List<Map<String,Object>> products = (List<Map<String, Object>>) map.get("giftProducts");//需要赠送的商品
|
|
|
|
-// for (Map<String,Object> m:products) {
|
|
|
|
-// Integer giftProductId = Integer.parseInt(m.get("id").toString());
|
|
|
|
-// Integer giftProductNum = Integer.parseInt(m.get("num").toString());
|
|
|
|
-// jsonModel = savejoinProductGift(String.valueOf(actType), fullGiftProductId, giftProductId, giftProductNum);
|
|
|
|
-// if("1".equals(jsonModel.getErrcode())){
|
|
|
|
-// //存在异常
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// }else if("3".equals(actType.toString())){//3满减
|
|
|
|
-// if(null==map.get("reduceAmount")|| StringUtils.isEmpty(String.valueOf(map.get("reduceAmount")))){
|
|
|
|
-// jsonModel.error("满减金额为空");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// if(null==map.get("fullAmount")|| StringUtils.isEmpty(String.valueOf(map.get("fullAmount")))){
|
|
|
|
-// jsonModel.error("满减金额为空");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// Float reduceAmount = Float.parseFloat(map.get("reduceAmount").toString());
|
|
|
|
-// Float fullAmount = Float.parseFloat(map.get("fullAmount").toString());
|
|
|
|
-// Product product = productInfo;
|
|
|
|
-// product.setActFullReduceAmount(fullAmount);//满减金额(达到该金额后可享直减)--满减
|
|
|
|
-// product.setActReduceAmount(reduceAmount);//购买直减金额(达到满金额后)
|
|
|
|
-// //保存商品参加活动信息
|
|
|
|
-// saveJoinActivity(product,productInfo,actType,beginTime,endTime,normalPrice,actPrice0,actPrice1,fullGiftProductId);
|
|
|
|
-// }else if("4".equals(actType.toString())){//表示团购
|
|
|
|
-// Product product = productInfo;
|
|
|
|
-// //保存商品参加活动信息
|
|
|
|
-// saveJoinActivity(product,productInfo,actType,beginTime,endTime,normalPrice,actPrice0,actPrice1,fullGiftProductId);
|
|
|
|
-//
|
|
|
|
-//
|
|
|
|
-// }else if("5".equals(actType.toString())){//表示热卖
|
|
|
|
-// Product product = productInfo;
|
|
|
|
-// //保存商品参加活动信息
|
|
|
|
-// saveJoinActivity(product,productInfo,actType,beginTime,endTime,normalPrice,actPrice0,actPrice1,fullGiftProductId);
|
|
|
|
-//
|
|
|
|
-// }else{
|
|
|
|
-// jsonModel.error("活动类型错误");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// jsonModel.success();
|
|
|
|
-// }catch (Exception e){
|
|
|
|
-// jsonModel.error(CodeMsg.COMMON_ERRO.getCode(),CodeMsg.COMMON_ERRO.getMsg());
|
|
|
|
-// logger.error(e.toString(),e);
|
|
|
|
-// }
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-
|
|
|
|
-// /**
|
|
|
|
-// * 满减、满赠、买赠 通用方法
|
|
|
|
-// * @param product
|
|
|
|
-// * @param productInfo
|
|
|
|
-// * @param actType 1:满赠、2:买赠、3满减、4团购、5热卖
|
|
|
|
-// * @param beginTime
|
|
|
|
-// * @param endTime
|
|
|
|
-// * @param normalPrice
|
|
|
|
-// * @param actPrice0
|
|
|
|
-// * @param actPrice1
|
|
|
|
-// * @param fullGiftProductId
|
|
|
|
-// */
|
|
|
|
-// public void saveJoinActivity(Product product, Product productInfo, Integer actType, Date beginTime, Date endTime, Float normalPrice, Float actPrice0, Float actPrice1, Integer fullGiftProductId){
|
|
|
|
-// //活动类型(1000热卖 1001团购 1002分期 1003满减 1004满增 1005买增)
|
|
|
|
-// if("1".equals(actType.toString())){
|
|
|
|
-// product.setActType("1004");
|
|
|
|
-// }
|
|
|
|
-// if("2".equals(actType.toString())){
|
|
|
|
-// product.setActType("1005");
|
|
|
|
-// }
|
|
|
|
-// if("3".equals(actType.toString())){
|
|
|
|
-// product.setActType("1003");
|
|
|
|
-// }
|
|
|
|
-// if("4".equals(actType.toString())){
|
|
|
|
-// product.setActType("1001");
|
|
|
|
-// }
|
|
|
|
-// if("5".equals(actType.toString())){
|
|
|
|
-// product.setActType("1000");
|
|
|
|
-// }
|
|
|
|
-// product.setActFlag("1");//是否活动商品:1是,空或0不是
|
|
|
|
-//// product.setValidFlag(ProductStatus.WAIT_CHECK.getCode());
|
|
|
|
-// product.setBeginTime(beginTime);
|
|
|
|
-// product.setEndTime(endTime);
|
|
|
|
-// product.setNormalPrice(normalPrice);
|
|
|
|
-// product.setActPrice0(actPrice0);
|
|
|
|
-// product.setActPrice1(actPrice1);
|
|
|
|
-// product.setUpdateTime(DateUtils.getDate());
|
|
|
|
-//
|
|
|
|
-// //保存商品价格修改记录
|
|
|
|
-// ProductPriceRecord record = new ProductPriceRecord();
|
|
|
|
-// if(null != productInfo && actPrice0.equals(productInfo.getPrice0()) && actPrice1.equals(productInfo.getPrice1())) {
|
|
|
|
-// record = null;
|
|
|
|
-// } else {
|
|
|
|
-// Product p = productService.get(String.valueOf(fullGiftProductId));
|
|
|
|
-// record.setPrice0(actPrice0);
|
|
|
|
-// record.setPrice1(actPrice1);
|
|
|
|
-// record.setShopID(productInfo.getShopID());
|
|
|
|
-// record.setUpdateTime(DateUtils.getDate());
|
|
|
|
-// record.setProductID(fullGiftProductId);
|
|
|
|
-// }
|
|
|
|
-// //保存加入购物车
|
|
|
|
-// productService.save(product);
|
|
|
|
-// if(record != null) {
|
|
|
|
-// productService.insertProductPriceRecord(record);
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-// /**
|
|
|
|
-// * 保存赠送商品公用方法
|
|
|
|
-// * @param actType actType 活动类型,1:满赠、2:买赠
|
|
|
|
-// * @param fullGiftProductId 参与满、买赠商品ID
|
|
|
|
-// * @param giftProductId 赠送商品ID
|
|
|
|
-// * @Param giftProductNum 赠送商品数量
|
|
|
|
-// * @return
|
|
|
|
-// */
|
|
|
|
-// public JsonModel savejoinProductGift(String actType,Integer fullGiftProductId,Integer giftProductId,Integer giftProductNum) {
|
|
|
|
-// JsonModel jsonModel=new JsonModel();
|
|
|
|
-// try{
|
|
|
|
-// Product productInfo = productService.get(String.valueOf(giftProductId));
|
|
|
|
-// GiftProduct giftProduct = new GiftProduct();//需要通过满赠、活动类型、赠送商品ID来唯一确认(标记删除也需要)
|
|
|
|
-// giftProduct.setActType(actType);
|
|
|
|
-// giftProduct.setFullGiftProductId(fullGiftProductId);
|
|
|
|
-// giftProduct.setGiftProductId(giftProductId);
|
|
|
|
-// List<GiftProduct> giftProductInfo = productService.getGiftProductInfo(giftProduct);
|
|
|
|
-// if(CollectionUtils.isNotEmpty(giftProductInfo) && giftProductInfo.size() == 1){
|
|
|
|
-// //执行更新
|
|
|
|
-// giftProduct = giftProductInfo.get(0);
|
|
|
|
-// if(null != productInfo){
|
|
|
|
-// giftProduct.setProductName(productInfo.getName());
|
|
|
|
-// }
|
|
|
|
-//
|
|
|
|
-// giftProduct.setGiftProductNum(giftProductNum);
|
|
|
|
-// giftProduct.setUpdateBy(UserUtils.getUser());
|
|
|
|
-// giftProduct.setUpdateDate(new Date());
|
|
|
|
-// giftProduct.setDelFlag("0");//存在更新标记删除的,复用删除数据
|
|
|
|
-// //保存数据
|
|
|
|
-// productService.updateGiftProudct(giftProduct);
|
|
|
|
-//
|
|
|
|
-// }else if(CollectionUtils.isEmpty(giftProductInfo)){
|
|
|
|
-// //执行插入
|
|
|
|
-// if(null != productInfo){
|
|
|
|
-// giftProduct.setProductName(productInfo.getName());
|
|
|
|
-// }
|
|
|
|
-// giftProduct.setGiftProductNum(giftProductNum);
|
|
|
|
-// giftProduct.setCreateBy(UserUtils.getUser());
|
|
|
|
-// giftProduct.setCreateDate(new Date());
|
|
|
|
-// giftProduct.setUpdateBy(UserUtils.getUser());
|
|
|
|
-// giftProduct.setUpdateDate(new Date());
|
|
|
|
-// giftProduct.setDelFlag("0");
|
|
|
|
-// //保存数据
|
|
|
|
-// productService.insertGiftProudct(giftProduct);
|
|
|
|
-// }else{
|
|
|
|
-// jsonModel.error("赠品信息异常");
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-// jsonModel.success();
|
|
|
|
-// }catch (Exception e){
|
|
|
|
-// jsonModel.error(CodeMsg.COMMON_ERRO.getCode(),CodeMsg.COMMON_ERRO.getMsg());
|
|
|
|
-// logger.error(e.toString(),e);
|
|
|
|
-// }
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-// /**
|
|
|
|
-// * 移除赠送商品
|
|
|
|
-// * @param actType 活动类型,1:满赠、2:买赠
|
|
|
|
-// * @param fullGiftProductId 满赠商品的ID
|
|
|
|
-// * @param giftProductId 赠送商品的ID
|
|
|
|
-// * @return
|
|
|
|
-// */
|
|
|
|
-// @ResponseBody
|
|
|
|
-// @RequestMapping("joinActProductInfo")
|
|
|
|
-// public JsonModel joinActProductInfo(String actType,Integer fullGiftProductId,Integer giftProductId) {
|
|
|
|
-// JsonModel jsonModel=new JsonModel();
|
|
|
|
-// com.thinkgem.jeesite.modules.sys.entity.User user = UserUtils.getUser();
|
|
|
|
-// try{
|
|
|
|
-// Product productInfo = productService.get(String.valueOf(giftProductId));
|
|
|
|
-// GiftProduct giftProduct = new GiftProduct();//需要通过满赠、活动类型、赠送商品ID来唯一确认(标记删除也需要)
|
|
|
|
-// giftProduct.setActType(actType);
|
|
|
|
-// giftProduct.setFullGiftProductId(fullGiftProductId);
|
|
|
|
-// giftProduct.setGiftProductId(giftProductId);
|
|
|
|
-// List<GiftProduct> giftProductInfo = productService.getGiftProductInfo(giftProduct);
|
|
|
|
-// if(CollectionUtils.isNotEmpty(giftProductInfo) && giftProductInfo.size() == 1){
|
|
|
|
-// //执行更新
|
|
|
|
-// giftProduct = giftProductInfo.get(0);
|
|
|
|
-// giftProduct.setUpdateBy(UserUtils.getUser());
|
|
|
|
-// giftProduct.setUpdateDate(new Date());
|
|
|
|
-// giftProduct.setDelFlag(DateUtils.getDateTime());//标记暂时移除
|
|
|
|
-// //保存数据
|
|
|
|
-// productService.updateGiftProudct(giftProduct);
|
|
|
|
-// }
|
|
|
|
-// jsonModel.success();
|
|
|
|
-// }catch (Exception e){
|
|
|
|
-// jsonModel.error(CodeMsg.COMMON_ERRO.getCode(),CodeMsg.COMMON_ERRO.getMsg());
|
|
|
|
-// logger.error(e.toString(),e);
|
|
|
|
-// }
|
|
|
|
-// return jsonModel;
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-// /**
|
|
|
|
-// * 1开启 0 不启用
|
|
|
|
-// * @param enabledStatus
|
|
|
|
-// * @param ids
|
|
|
|
-// * @param supplierIDs
|
|
|
|
-// * @param request
|
|
|
|
-// * @param response
|
|
|
|
-// * @return
|
|
|
|
-// */
|
|
|
|
-// @RequiresPermissions("product:product:edit")
|
|
|
|
-// @ResponseBody
|
|
|
|
-// @RequestMapping(value="updateCRMFlag")
|
|
|
|
-// public Map<String, Object> updateCRMFlag(String enabledStatus, String[] ids, String [] supplierIDs, HttpServletRequest request, HttpServletResponse response){
|
|
|
|
-// Map<String, Object> map = Maps.newLinkedHashMap();
|
|
|
|
-// try {
|
|
|
|
-// productService.updateCRMFlag(enabledStatus,ids);
|
|
|
|
-// map.put("success",true);
|
|
|
|
-// map.put("msg", "修改成功");
|
|
|
|
-// } catch (Exception e) {
|
|
|
|
-// logger.debug(e.toString(),e);
|
|
|
|
-// map.put("success",false);
|
|
|
|
-// map.put("msg", "修改失败");
|
|
|
|
-// }
|
|
|
|
-// return map;
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 是否包邮 0包邮 1不包邮
|
|
* 是否包邮 0包邮 1不包邮
|
|
* @param enabledStatus
|
|
* @param enabledStatus
|
|
@@ -1359,27 +810,6 @@ public class ProductController extends BaseController{
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value="getBigTypeList")
|
|
|
|
- public JsonModel getBigTypeList(Integer bigTypeID, Integer productID) {
|
|
|
|
- JsonModel jsonModel = JsonModel.newInstance();
|
|
|
|
- List<ProductBigType> data = productService.getBigTypeList(bigTypeID);
|
|
|
|
- if (productID != null) {
|
|
|
|
- List<ProductCustomClassification> types = productService.getProductTypes(productID);
|
|
|
|
- for (ProductCustomClassification p : types) {
|
|
|
|
- for (ProductBigType b : data) {
|
|
|
|
- if (p.getBigTypeID().intValue() == b.getBigTypeID()) {
|
|
|
|
- b.setCheck(true);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return jsonModel.success(data);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@RequestMapping(value="getProductTypeNameAndID")
|
|
@RequestMapping(value="getProductTypeNameAndID")
|
|
public JsonModel getProductTypeNameAndID(Integer tinyTypeID) {
|
|
public JsonModel getProductTypeNameAndID(Integer tinyTypeID) {
|
|
@@ -1388,147 +818,11 @@ public class ProductController extends BaseController{
|
|
return jsonModel.success(data);
|
|
return jsonModel.success(data);
|
|
}
|
|
}
|
|
|
|
|
|
- /** request params ====> {id: productID, typeIDs : 1_2_3_4.....自定义分类不能超过5个}
|
|
|
|
- * @param product 商品
|
|
|
|
- * @param typeIDs 最小分类的 tinyID
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value="editProductCustomClassification")
|
|
|
|
- public JsonModel editProductCustomClassification(Product product, String typeIDs) {
|
|
|
|
- logger.info("typeIDs: " + typeIDs);
|
|
|
|
- JsonModel jsonModel = JsonModel.newInstance();
|
|
|
|
- if (product.getId() == null)
|
|
|
|
- return jsonModel.error("商品不存在");
|
|
|
|
- if (StringUtils.isEmpty(typeIDs)) {
|
|
|
|
- return jsonModel.error("分类信息异常");
|
|
|
|
- }
|
|
|
|
- String[] ids = typeIDs.split("_");
|
|
|
|
- List<String> list = new ArrayList<>();
|
|
|
|
- for (String s : ids) {
|
|
|
|
- if (!list.contains(s) && !"".equals(s))
|
|
|
|
- list.add(s);
|
|
|
|
- }
|
|
|
|
- ids = list.toArray(new String[list.size()]);
|
|
|
|
- if (ids.length > 5) {
|
|
|
|
- return jsonModel.error("自定义分类不能超过5个");
|
|
|
|
- }
|
|
|
|
- try {
|
|
|
|
- jsonModel = productService.editProductCustomClassification(Integer.valueOf(product.getId()), ids);
|
|
|
|
- } catch (Exception e){
|
|
|
|
- jsonModel.error("数据异常");
|
|
|
|
- }
|
|
|
|
- return jsonModel;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value="getSmallTypeList")
|
|
|
|
- public JsonModel getSmallTypeList(Integer bigTypeID, Integer smallTypeID, Integer productID) {
|
|
|
|
- JsonModel jsonModel = JsonModel.newInstance();
|
|
|
|
- List<ProductSmallType> data = productService.getSmallTypeList(bigTypeID, smallTypeID);
|
|
|
|
- if (productID != null) {
|
|
|
|
- List<ProductCustomClassification> types = productService.getProductTypes(productID);
|
|
|
|
- for (ProductCustomClassification p : types) {
|
|
|
|
- for (ProductSmallType b : data) {
|
|
|
|
- if (p.getSmallTypeID().intValue() == b.getSmallTypeID()) {
|
|
|
|
- b.setCheck(true);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return jsonModel.success(data);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value="getTinyTypeList")
|
|
|
|
- public JsonModel getTinyTypeList(Integer smallTypeID, Integer tinyTypeID, Integer productID) {
|
|
|
|
- JsonModel jsonModel = JsonModel.newInstance();
|
|
|
|
- List<ProducTinyType> data = productService.getTinyTypeList(smallTypeID, tinyTypeID);
|
|
|
|
- if (productID != null) {
|
|
|
|
- List<ProductCustomClassification> types = productService.getProductTypes(productID);
|
|
|
|
- for (ProductCustomClassification p : types) {
|
|
|
|
- for (ProducTinyType b : data) {
|
|
|
|
- if (p.getTinyTypeID().intValue() == b.getTinyTypeID()) {
|
|
|
|
- b.setCheck(true);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return jsonModel.success(data);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 最小分类的相关商品
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @RequestMapping(value="relatedProductList")
|
|
|
|
- public String relatedProductList(Product product, HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
|
|
- Page<Product> page = productService.relatedProductList(new Page<Product>(request, response), product);
|
|
|
|
- if(null!= page && null != page.getList()){
|
|
|
|
- List<Product> list = page.getList();
|
|
|
|
- for(Product p:list){
|
|
|
|
- p.setMainImage(AppUtils.getImageURL("product", p.getMainImage(), 0, ""));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- model.addAttribute("page", page);
|
|
|
|
- model.addAttribute("tinyTypeID", product.getTinyTypeID());
|
|
|
|
- return "modules/product/relatedProductList";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 删除自定义分类 params productID tinyTypeID
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value="deleteProductCustomClassification")
|
|
|
|
- public JsonModel deleteProductCustomClassification(Integer productID, Integer tinyTypeID) {
|
|
|
|
- JsonModel jsonModel = JsonModel.newInstance();
|
|
|
|
- try{
|
|
|
|
- productService.deleteProductCustomClassification(productID, tinyTypeID);
|
|
|
|
- jsonModel.success();
|
|
|
|
- } catch (Exception e){
|
|
|
|
- jsonModel.error("数据异常");
|
|
|
|
- }
|
|
|
|
- return jsonModel;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 细分类下 添加自定义分类商品的商品选择列表
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @ResponseBody
|
|
|
|
- @RequestMapping(value="toAddProductCustomClassificationList")
|
|
|
|
- public JsonModel toAddProductCustomClassificationList(Product product, Model model, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
- JsonModel jsonModel = JsonModel.newInstance();
|
|
|
|
- Page<Product> page = productService.toAddProductCustomClassificationList(new Page<Product>(request, response), product);
|
|
|
|
- if(null!= page && null != page.getList()){
|
|
|
|
- List<Product> list = page.getList();
|
|
|
|
- for(Product p:list){
|
|
|
|
- p.setMainImage(AppUtils.getImageURL("product", p.getMainImage(), 0, ""));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return jsonModel.success(page);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 添加商品至自定义分类
|
|
|
|
- * @param productID
|
|
|
|
- * @param tinyTypeID
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- @RequestMapping(value="addProductCustomClassification")
|
|
|
|
- public String addProductCustomClassification(Integer productID, Integer tinyTypeID, RedirectAttributes redirectAttributes) {
|
|
|
|
- productService.addProductCustomClassification(productID, tinyTypeID);
|
|
|
|
- addMessage(redirectAttributes, "保存商品信息成功");
|
|
|
|
- return "redirect:"+ Global.getAdminPath()+"/product/relatedProductList?tinyTypeID="+tinyTypeID;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
@RequestMapping(value="getProductTypes")
|
|
@RequestMapping(value="getProductTypes")
|
|
public JsonModel getProductTypes(Integer productID) {
|
|
public JsonModel getProductTypes(Integer productID) {
|
|
JsonModel jsonModel = JsonModel.newInstance();
|
|
JsonModel jsonModel = JsonModel.newInstance();
|
|
- List<ProductCustomClassification> data = productService.getProductTypes(productID);
|
|
|
|
- return jsonModel.success(data);
|
|
|
|
|
|
+ return jsonModel.success();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1562,83 +856,6 @@ public class ProductController extends BaseController{
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|
|
|
|
|
|
-/* *//**
|
|
|
|
- * 相关商品推荐
|
|
|
|
- * @return
|
|
|
|
- *//*
|
|
|
|
- @RequestMapping(value="productRecommend")
|
|
|
|
- public String productRecommend(Integer productID, Integer bigTypeID, Integer smallTypeID, Integer tinyTypeID,
|
|
|
|
- String productName, String shopName, String recommendType,
|
|
|
|
- HttpServletRequest request, HttpServletResponse response, Model model) {
|
|
|
|
- Product product = productService.get(String.valueOf(productID));
|
|
|
|
- List<CmProductRecommend> recommendList;
|
|
|
|
- int manualRecommend; //记录手动推荐时数据库中相关商品的数量
|
|
|
|
- if ("1".equals(product.getRecommendType())) {
|
|
|
|
- recommendList = productService.findProductRecommendList(productID);
|
|
|
|
- manualRecommend = recommendList.size();
|
|
|
|
- } else {
|
|
|
|
- recommendList = productService.findRecommendBySys(product);
|
|
|
|
- manualRecommend = productService.findProductRecommendCount(productID);
|
|
|
|
- }
|
|
|
|
- List<CmProductRecommend> list = productService.findProductList(bigTypeID, smallTypeID,
|
|
|
|
- tinyTypeID, productName, shopName);
|
|
|
|
- for (CmProductRecommend l : list) {
|
|
|
|
- l.setImg(AppUtils.getImageURL("product", l.getImg(), 0, ""));
|
|
|
|
- for (CmProductRecommend cpr : recommendList) {
|
|
|
|
- if (cpr.getRecommendProductID().intValue() == l.getProductID()) {
|
|
|
|
- l.setSort(cpr.getSort());
|
|
|
|
- l.setCheck(true);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- for (CmProductRecommend cpr : recommendList) {
|
|
|
|
- cpr.setImg(AppUtils.getImageURL("product", cpr.getImg(), 0, ""));
|
|
|
|
- }
|
|
|
|
- if (StringUtils.isEmpty(recommendType))
|
|
|
|
- model.addAttribute("recommendType", product.getRecommendType());
|
|
|
|
- else
|
|
|
|
- model.addAttribute("recommendType", recommendType);
|
|
|
|
- model.addAttribute("product", product);
|
|
|
|
- model.addAttribute("recommendList", recommendList);
|
|
|
|
- model.addAttribute("list", list);
|
|
|
|
- model.addAttribute("bigTypeID", bigTypeID);
|
|
|
|
- model.addAttribute("smallTypeID", smallTypeID);
|
|
|
|
- model.addAttribute("tinyTypeID", tinyTypeID);
|
|
|
|
- model.addAttribute("productName", productName);
|
|
|
|
- model.addAttribute("shopName", shopName);
|
|
|
|
- //最多只能添加15条相关商品
|
|
|
|
- model.addAttribute("full", recommendList.size() >= 15 ? 1 : 0);
|
|
|
|
- model.addAttribute("dbProductNum", manualRecommend);
|
|
|
|
-
|
|
|
|
- return "/modules/product/recommendProductList";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- *//**g
|
|
|
|
- * 保存相关商品推荐
|
|
|
|
- * @param params [productID:sort, .....]
|
|
|
|
- * @return
|
|
|
|
- *//*
|
|
|
|
- @RequestMapping(value="addProductRecommend")
|
|
|
|
- public String addProductRecommend(String productID, String[] params, String recommendType) {
|
|
|
|
- productService.updateRecommendType(productID, recommendType);
|
|
|
|
- if (params != null) {
|
|
|
|
- for (String base : params) {
|
|
|
|
- cmProductRecommendService.addRecommendProduct(productID, base.split(":")[0], base.split(":")[1]);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return "redirect:"+Global.getAdminPath()+"/product/productRecommend/?productID=" + productID;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- *//**
|
|
|
|
- * 保存相关商品推荐
|
|
|
|
- * @return
|
|
|
|
- *//*
|
|
|
|
- @RequestMapping(value="deleteProductRecommend")
|
|
|
|
- public String deleteProductRecommend(String productID, String id) {
|
|
|
|
- cmProductRecommendService.deleteProductRecommend(id);
|
|
|
|
- return "redirect:"+Global.getAdminPath()+"/product/productRecommend/?productID=" + productID;
|
|
|
|
- }*/
|
|
|
|
/**
|
|
/**
|
|
* 获取产品推荐排序
|
|
* 获取产品推荐排序
|
|
*/
|
|
*/
|