嗨森逛服务
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
hai-server/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java

67 lines
2.5 KiB

package com.cweb.controller;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.BsCompany;
import com.hai.entity.CmsContent;
import com.hai.entity.CmsPatch;
import com.hai.entity.SecRegion;
import com.hai.model.CmsContentModel;
import com.hai.model.ResponseData;
import com.hai.model.UserInfoModel;
import com.hai.service.BsCompanyService;
import com.hai.service.CmsContentService;
import com.hai.service.CmsPatchService;
import com.hai.service.CommonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@Controller
@Api(value = "内容管理 内容发布")
@RequestMapping(value = "/cmsContent")
public class CmsContentController {
private static Logger log = LoggerFactory.getLogger(CmsContentController.class);
@Resource
private CommonService commonService;
@Resource
private CmsContentService cmsContentService;
@Resource
private BsCompanyService bsCompanyService;
@RequestMapping(value = "/getCmsContent", method = RequestMethod.GET)
@ApiOperation(value = "查询首页轮播图")
@ResponseBody
public ResponseData getCmsContent(@RequestParam(name = "regionId", required = true) String regionId,
@RequestParam(name = "categoryCode", required = true) String categoryCode) {
try {
SecRegion region = commonService.getParentByRegion(Long.parseLong(regionId));
if (region != null) {
BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString());
if (bsCompany != null) {
Map<String,String> map = new HashMap<>();
map.put("companyId", bsCompany.getId().toString());
map.put("status", "2");
map.put("categoryCode", categoryCode);
return ResponseMsgUtil.success(cmsContentService.getListContentByCrest(map));
}
}
return ResponseMsgUtil.success(new ArrayList<>());
} catch (Exception e) {
log.error("CmsContentController --> getCorporateAdvertising() error!", e);
return ResponseMsgUtil.exception(e);
}
}
}