285 lines
8.1 KiB
Java
285 lines
8.1 KiB
Java
package com.ifish.action;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
import com.ifish.domain.JsonResult;
|
|
import com.ifish.entity.ShopsInfo;
|
|
import com.ifish.enums.ShopsStatusEnum;
|
|
import com.ifish.enums.SysUserEnum;
|
|
import com.ifish.exception.IfishException;
|
|
import com.ifish.search.PageDataDto;
|
|
import com.ifish.service.ShopsInfoService;
|
|
import com.ifish.util.IfishFileDirectory;
|
|
import com.ifish.util.IfishFileUtils;
|
|
import com.ifish.util.ResultUtil;
|
|
import com.ifishNew.bean.CommodityInfoBean;
|
|
import com.ifishNew.help.CommodityInfoHelperI;
|
|
|
|
/**
|
|
* 商家信息controller
|
|
*
|
|
* @author Administrator
|
|
*
|
|
*/
|
|
@Controller
|
|
public class ShopsInfoAction {
|
|
|
|
@Autowired
|
|
private ShopsInfoService shopsInfoService;
|
|
|
|
@Autowired
|
|
private CommodityInfoHelperI commodityInfoHelperI;
|
|
|
|
/**
|
|
* 已审核商家信息页面
|
|
*
|
|
* @return
|
|
*/
|
|
@RequestMapping(value = "/shopsInfo.do")
|
|
public ModelAndView shopsInfo() {
|
|
return new ModelAndView("shopsInfo/shopsInfo");
|
|
}
|
|
|
|
/**
|
|
* 已审核分页数据
|
|
*
|
|
* @param pageData
|
|
* @param shopsInfo
|
|
* @return
|
|
*/
|
|
@RequestMapping(value = "/shopsInfoData.do")
|
|
@ResponseBody
|
|
public PageDataDto getShopsInfoByPage(PageDataDto pageData, ShopsInfo shopsInfo) {
|
|
shopsInfo.setStatus(ShopsStatusEnum.status1.getKey());
|
|
pageData.pageData(shopsInfoService.getShopsInfoByPage(pageData, shopsInfo));
|
|
return pageData;
|
|
}
|
|
|
|
/**
|
|
* 未审核商家信息页面
|
|
*
|
|
* @return
|
|
*/
|
|
@RequestMapping(value = "/shopsInfo2.do")
|
|
public ModelAndView shopsInfo2() {
|
|
return new ModelAndView("shopsInfo/shopsInfo2");
|
|
}
|
|
|
|
/**
|
|
* 未审核分页数据
|
|
*
|
|
* @param pageData
|
|
* @param shopsInfo
|
|
* @return
|
|
*/
|
|
@RequestMapping(value = "/shopsInfoData2.do")
|
|
@ResponseBody
|
|
public PageDataDto getShopsInfoByPage2(PageDataDto pageData, ShopsInfo shopsInfo) {
|
|
shopsInfo.setStatus(ShopsStatusEnum.status1.getKey());
|
|
pageData.pageData(shopsInfoService.getShopsInfoByPage2(pageData, shopsInfo));
|
|
return pageData;
|
|
}
|
|
|
|
/**
|
|
* 是否显示
|
|
*
|
|
* @param shopsId
|
|
* @param appShow
|
|
* @return
|
|
*/
|
|
@RequestMapping(value = "/shopsInfo/appShowUpdate.do")
|
|
@ResponseBody
|
|
public JsonResult appShowUpdate(Integer shopsId, boolean appShow) {
|
|
return shopsInfoService.shopsInfoShowUpdate(shopsId, appShow);
|
|
}
|
|
|
|
/**
|
|
* 是否屏蔽
|
|
*
|
|
* @param shopsId
|
|
* @param isPingBi
|
|
* @return
|
|
*/
|
|
@RequestMapping(value = "/shopsInfo/pingBiUpdate.do")
|
|
@ResponseBody
|
|
public JsonResult isPingBiWeChat(Integer shopsId, boolean isPingBi) {
|
|
return shopsInfoService.isPingBiWeChat(shopsId, isPingBi);
|
|
}
|
|
|
|
/**
|
|
* 上传封面
|
|
*
|
|
* @param shopsId
|
|
* @param fileUpload
|
|
* @return
|
|
*/
|
|
@RequestMapping(value = "/shopsInfo/uploadPicture.do")
|
|
@ResponseBody
|
|
public JsonResult uploadPicture(Integer shopsId, Integer userId, MultipartFile fileUpload) {
|
|
String newImgName = null;
|
|
String oldImgName = null;
|
|
//上传新封面图
|
|
if (fileUpload != null) {
|
|
try {
|
|
//上传文件
|
|
newImgName = String.valueOf(System.currentTimeMillis()) + ".png";
|
|
IfishFileUtils.uploadFile(IfishFileDirectory.path_picture4 + "/" + userId, newImgName, fileUpload);
|
|
} catch (IfishException e) {
|
|
throw e;
|
|
} catch (Exception e) {
|
|
throw new IfishException(SysUserEnum.warn113);
|
|
}
|
|
//老封面图
|
|
oldImgName = shopsInfoService.updatePicture(shopsId, newImgName);
|
|
}
|
|
//删除老封面图
|
|
if (StringUtils.isNotBlank(oldImgName)) {
|
|
IfishFileUtils.deleteFile(IfishFileDirectory.path_picture4 + "/" + userId, oldImgName);
|
|
}
|
|
return ResultUtil.success();
|
|
}
|
|
|
|
/**
|
|
* 商家审核页面
|
|
*
|
|
* @return
|
|
*/
|
|
@RequestMapping("/shopsInfo/reviewPage.do")
|
|
public ModelAndView review(Model model, Integer shopsId) {
|
|
model.addAttribute("shopsInfo", shopsInfoService.getShopsInfoById(shopsId));
|
|
return new ModelAndView("shopsInfo/reviewPage");
|
|
}
|
|
|
|
/**
|
|
* 商家审核
|
|
*
|
|
* @param shopsId
|
|
* @param status
|
|
* @return
|
|
*/
|
|
@RequestMapping("/shopsInfo/reviewShops.do")
|
|
public ModelAndView reviewShops(Model model, Integer shopsId, String status, String reason) {
|
|
JsonResult jsonResult = shopsInfoService.reviewShopsInfo(shopsId, status, reason);
|
|
model.addAttribute("status", jsonResult.getResult());
|
|
model.addAttribute("msg", jsonResult.getMsg());
|
|
//return new ModelAndView("redirect:/page/shopsInfo2.do");
|
|
return new ModelAndView("shopsInfo/shopsInfo2");
|
|
}
|
|
|
|
/**
|
|
* 看护列表页面
|
|
*
|
|
* @param model
|
|
* @param shopsUserId
|
|
* @param shopsId
|
|
* @return
|
|
*/
|
|
@RequestMapping("/shopsInfo/lookList.do")
|
|
public ModelAndView lookList(Model model, Integer shopsUserId, Integer shopsId) {
|
|
model.addAttribute("shopsUserId", shopsUserId);
|
|
model.addAttribute("shopsInfo", shopsInfoService.getShopsInfoById(shopsId));
|
|
return new ModelAndView("shopsInfo/lookList");
|
|
}
|
|
|
|
/**
|
|
* 看护列表数据
|
|
*
|
|
* @param pageData
|
|
* @param shopsUserId
|
|
* @return
|
|
*/
|
|
@RequestMapping("/shopsInfo/lookListInfo.do")
|
|
@ResponseBody
|
|
public PageDataDto lookListInfo(PageDataDto pageData, Integer shopsUserId) {
|
|
pageData.pageData(shopsInfoService.getLookListInfo(pageData, shopsUserId));
|
|
return pageData;
|
|
}
|
|
|
|
/**
|
|
* 商家会员页面
|
|
*
|
|
* @param model
|
|
* @param shopsId
|
|
* @return
|
|
*/
|
|
@RequestMapping("/shopsUserInfo.do")
|
|
public ModelAndView shopsUserInfo(Model model, Integer shopsId) {
|
|
model.addAttribute("shopsId", shopsId);
|
|
model.addAttribute("shopsInfo", shopsInfoService.getShopsInfoById(shopsId));
|
|
return new ModelAndView("shopsInfo/shopsUserInfo");
|
|
}
|
|
|
|
/**
|
|
* 商家会员信息
|
|
*
|
|
* @param pageData
|
|
* @param shopsId
|
|
* @return
|
|
*/
|
|
@RequestMapping("/shopsUserInfo/shopsUserInfoData.do")
|
|
@ResponseBody
|
|
public PageDataDto getShopsUserInfoByPage(PageDataDto pageData, Integer shopsId) {
|
|
pageData.pageData(shopsInfoService.getShopsUserInfoByPage(pageData, shopsId));
|
|
return pageData;
|
|
}
|
|
|
|
/**
|
|
* 修改备注
|
|
*
|
|
* @param shopsId
|
|
* @param remark
|
|
* @return
|
|
*/
|
|
@RequestMapping("/shopsInfo/updateRemark.do")
|
|
@ResponseBody
|
|
public JsonResult updateShopsInfoRemark(Integer shopsId, String remark) {
|
|
return shopsInfoService.updateShopsInfoRemark(shopsId, remark);
|
|
}
|
|
|
|
/**
|
|
* 商品管理页面
|
|
*
|
|
* @return
|
|
*/
|
|
@RequestMapping("/shopsInfo/goodsView.do")
|
|
@ResponseBody
|
|
public ModelAndView getGoodsView() {
|
|
ModelAndView mv = new ModelAndView();
|
|
mv = commodityInfoHelperI.getGoodsPage(mv);
|
|
mv.setViewName("shopsInfo/goodsView");
|
|
return mv;
|
|
}
|
|
|
|
/**
|
|
* 修改商品
|
|
*
|
|
* @param commodityInfoBean
|
|
* @return
|
|
*/
|
|
@RequestMapping("/shopsInfo/updategoodsInfo.do")
|
|
@ResponseBody
|
|
public JsonResult updateGoodsInfoJsonResult(CommodityInfoBean commodityInfoBean,boolean appShow) {
|
|
return commodityInfoHelperI.updateCommodityInfo(commodityInfoBean,appShow);
|
|
}
|
|
|
|
/**
|
|
* 获取商品分页数据
|
|
*
|
|
* @param pageData
|
|
* @param commodityInfoBean
|
|
* @return
|
|
*/
|
|
@RequestMapping(value = "/shopsInfo/getGoodsList.do")
|
|
@ResponseBody
|
|
public PageDataDto getShopsInfoByPage2(PageDataDto pageData, CommodityInfoBean commodityInfoBean) {
|
|
return commodityInfoHelperI.getCommodityInfoByPage(pageData, commodityInfoBean);
|
|
}
|
|
}
|