|
@@ -0,0 +1,749 @@
|
|
|
+package com.wechat.controller;
|
|
|
+
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.io.OutputStream;
|
|
|
+import java.net.URLEncoder;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import org.apache.commons.logging.Log;
|
|
|
+import org.apache.commons.logging.LogFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+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.bind.annotation.ResponseBody;
|
|
|
+
|
|
|
+import com.wechat.common.Constants;
|
|
|
+import com.wechat.common.utils.Md5Utils;
|
|
|
+import com.wechat.common.utils.StringsUtils;
|
|
|
+import com.wechat.dao.RedisDPResp;
|
|
|
+import com.wechat.dao.RedisHotelBrandDao;
|
|
|
+import com.wechat.dao.RedisHotelCompanyDao;
|
|
|
+import com.wechat.dao.RedisHotelSubBrandDao;
|
|
|
+import com.wechat.dao.RedisLVResp;
|
|
|
+import com.wechat.dao.RedisPhoneCodeResp;
|
|
|
+import com.wechat.dao.RedisProvinceCityDao;
|
|
|
+import com.wechat.global.Init;
|
|
|
+import com.wechat.global.base.dao.RedisWithExpiryTimeDao;
|
|
|
+import com.wechat.global.message.InfoMsg;
|
|
|
+import com.wechat.model.dbEntity.MdeUser;
|
|
|
+import com.wechat.model.dto.AdImageDto;
|
|
|
+import com.wechat.model.dto.HotelBrandDto;
|
|
|
+import com.wechat.model.dto.HotelSubBrandDto;
|
|
|
+import com.wechat.model.dto.Province;
|
|
|
+import com.wechat.model.requestDto.AdCtrReq;
|
|
|
+import com.wechat.model.requestDto.AdReq;
|
|
|
+import com.wechat.model.responseDto.DPResp;
|
|
|
+import com.wechat.model.responseDto.HotelCompanyResp;
|
|
|
+import com.wechat.model.responseDto.LVResp;
|
|
|
+import com.wechat.model.responseDto.OpenAdResq;
|
|
|
+import com.wechat.model.responseDto.PhoneCodeResp;
|
|
|
+import com.wechat.model.responseDto.ResultEntity;
|
|
|
+import com.wechat.service.AreaService;
|
|
|
+import com.wechat.service.CommonService;
|
|
|
+import com.wechat.service.MdeAdImagesService;
|
|
|
+import com.wechat.service.MdeHotelBrandService;
|
|
|
+import com.wechat.service.MdeHotelCompanyService;
|
|
|
+import com.wechat.service.MdeHotelSubBrandService;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 公共请求类
|
|
|
+ *
|
|
|
+ * @author tangwc
|
|
|
+ *
|
|
|
+ */
|
|
|
+@Controller
|
|
|
+public class CommonController {
|
|
|
+
|
|
|
+ @Value("#{configProperties['upload.base.path']}")
|
|
|
+ private String basePackagePath;
|
|
|
+
|
|
|
+ @Value("#{configProperties['url.base']}")
|
|
|
+ private String domainUrl;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private CommonService commonService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MdeHotelBrandService mdeHotelBrandService;
|
|
|
+ @Autowired
|
|
|
+ private MdeHotelSubBrandService mdeHotelSubBrandService;
|
|
|
+ @Autowired
|
|
|
+ private MdeHotelCompanyService mdeHotelCompanyService;
|
|
|
+ @Autowired
|
|
|
+ private AreaService areaService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RedisWithExpiryTimeDao redisDao;
|
|
|
+ @Autowired
|
|
|
+ private RedisProvinceCityDao redisProvinceCityDao;
|
|
|
+ @Autowired
|
|
|
+ private RedisHotelBrandDao redisHotelBrandDao;
|
|
|
+ @Autowired
|
|
|
+ private RedisHotelSubBrandDao redisHotelSubBrandDao;
|
|
|
+ @Autowired
|
|
|
+ private RedisHotelCompanyDao redisHotelCompanyDao;
|
|
|
+ @Autowired
|
|
|
+ private RedisLVResp redisLVResp;
|
|
|
+ @Autowired
|
|
|
+ private RedisDPResp redisDPResp;
|
|
|
+ @Autowired
|
|
|
+ private RedisPhoneCodeResp redisPhoneCodeResp;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MdeAdImagesService adImagesService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private Init init;
|
|
|
+
|
|
|
+ protected static final Log log = LogFactory.getLog(CommonController.class);
|
|
|
+
|
|
|
+ @RequestMapping(value = "getBaseData", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<Map<String, Object>> getBaseData(HttpServletRequest request) {
|
|
|
+ String lang = commonService.getLanguage(request);
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ String departmentsAndPositions = null;// 部门职位
|
|
|
+ List<Province> provinceCityArea = null;// 省市区
|
|
|
+ List<Province> provinceCity = null;// 省市
|
|
|
+ List<HotelBrandDto> hotelBrands = null;// 酒店主品牌
|
|
|
+ List<HotelSubBrandDto> hotelSubBrands = null;// 酒店子品牌
|
|
|
+ List<HotelCompanyResp> hotelCompanys = null;// 酒店公司
|
|
|
+ List<LVResp> schoolList = null;// 学校列表
|
|
|
+ List<DPResp> workYear = null;// 工作年限
|
|
|
+ List<DPResp> workStatus = null;// 工作状态
|
|
|
+ List<DPResp> orderStatus = null;// 订单状态
|
|
|
+ List<DPResp> cvStatus = null;// 简历投递状态
|
|
|
+ List<DPResp> education = null;// 学历
|
|
|
+ List<DPResp> international = null;// 国际区分
|
|
|
+ List<PhoneCodeResp> phoneCode = null;// 国家码
|
|
|
+ // 判断redis中的基础数据是否过期
|
|
|
+ if(!redisDao.hasKey("departmentsAndPositions_en")) {
|
|
|
+ init.init();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ hotelCompanys = redisHotelCompanyDao.selectMessageInfo("hotelCompanys");
|
|
|
+ if(lang.equalsIgnoreCase("en")) {
|
|
|
+ departmentsAndPositions = redisDao.select("departmentsAndPositions_en");
|
|
|
+ provinceCityArea = redisProvinceCityDao.selectMessageInfo("provinceCityArea_en");
|
|
|
+ provinceCity = redisProvinceCityDao.selectMessageInfo("provinceCity_en");
|
|
|
+ hotelBrands = redisHotelBrandDao.selectMessageInfo("hotelBrands_en");
|
|
|
+ hotelSubBrands = redisHotelSubBrandDao.selectMessageInfo("hotelSubBrands_en");
|
|
|
+ schoolList = redisLVResp.selectMessageInfo("schoolList_en");
|
|
|
+ workYear = redisDPResp.selectMessageInfo("workYear_en");
|
|
|
+ workStatus = redisDPResp.selectMessageInfo("workStatus_en");
|
|
|
+ orderStatus = redisDPResp.selectMessageInfo("orderStatus_en");
|
|
|
+ cvStatus = redisDPResp.selectMessageInfo("cvStatus_en");
|
|
|
+ education = redisDPResp.selectMessageInfo("education_en");
|
|
|
+ international = redisDPResp.selectMessageInfo("international_en");
|
|
|
+ phoneCode = redisPhoneCodeResp.selectMessageInfo("phoneCode_en");
|
|
|
+ }else {
|
|
|
+ departmentsAndPositions = redisDao.select("departmentsAndPositions_cn");
|
|
|
+ provinceCityArea = redisProvinceCityDao.selectMessageInfo("provinceCityArea_cn");
|
|
|
+ provinceCity = redisProvinceCityDao.selectMessageInfo("provinceCity_cn");
|
|
|
+ hotelBrands = redisHotelBrandDao.selectMessageInfo("hotelBrands_cn");
|
|
|
+ hotelSubBrands = redisHotelSubBrandDao.selectMessageInfo("hotelSubBrands_cn");
|
|
|
+ schoolList = redisLVResp.selectMessageInfo("schoolList_cn");
|
|
|
+ workYear = redisDPResp.selectMessageInfo("workYear_cn");
|
|
|
+ workStatus = redisDPResp.selectMessageInfo("workStatus_cn");
|
|
|
+ orderStatus = redisDPResp.selectMessageInfo("orderStatus_cn");
|
|
|
+ cvStatus = redisDPResp.selectMessageInfo("cvStatus_cn");
|
|
|
+ education = redisDPResp.selectMessageInfo("education_cn");
|
|
|
+ international = redisDPResp.selectMessageInfo("international_cn");
|
|
|
+ phoneCode = redisPhoneCodeResp.selectMessageInfo("phoneCode_cn");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ departmentsAndPositions = commonService.getDepartmentsAndPositions(lang);// 部门职位
|
|
|
+ provinceCityArea = areaService.getAllArea(lang);// 省市区
|
|
|
+ provinceCity = areaService.getAllProvinceAndCity(lang);// 省市
|
|
|
+ hotelBrands = mdeHotelBrandService.getAllHotelInternational(lang);// 酒店主品牌
|
|
|
+ hotelSubBrands = mdeHotelSubBrandService.getAllHotelSubBrandInternational(lang);// 酒店子品牌
|
|
|
+ hotelCompanys = mdeHotelCompanyService.getAllHotelCompanyInternational();// 酒店公司
|
|
|
+ schoolList = commonService.getSchoolList("cn");// 学校列表
|
|
|
+ workYear = commonService.getDictByType("job_year",lang);// 工作年限
|
|
|
+ workStatus = commonService.getDictByType("work_status",lang);// 工作状态
|
|
|
+ orderStatus = commonService.getDictByType("order_status",lang);// 订单状态
|
|
|
+ cvStatus = commonService.getDictByType("cv_status",lang);// 简历投递状态
|
|
|
+ education = commonService.getDictByType("education",lang);// 学历
|
|
|
+ international = commonService.getDictByType("international",lang);// 国际区分
|
|
|
+ phoneCode = commonService.getPhoneCode("phone_code", lang);// 国家码
|
|
|
+ }
|
|
|
+ map.put("departmentsAndPositions", departmentsAndPositions);
|
|
|
+ map.put("provinceCityArea", provinceCityArea);
|
|
|
+ map.put("provinceCity", provinceCity);
|
|
|
+ map.put("hotelBrands", hotelBrands);
|
|
|
+ map.put("hotelSubBrands", hotelSubBrands);
|
|
|
+ map.put("hotelCompanys", hotelCompanys);
|
|
|
+ map.put("schoolList", schoolList);
|
|
|
+ map.put("workYear", workYear);
|
|
|
+ map.put("workStatus", workStatus);
|
|
|
+ map.put("orderStatus", orderStatus);
|
|
|
+ map.put("cvStatus", cvStatus);
|
|
|
+ map.put("education", education);
|
|
|
+ map.put("international", international);
|
|
|
+ map.put("phoneCode", phoneCode);
|
|
|
+ return new ResultEntity<Map<String, Object>>(InfoMsg.SUCCESS_REQUEST, map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取基础数据-注册用
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getBaseDataForRegister", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<Map<String, Object>> getBaseDataForRegister(HttpServletRequest request) {
|
|
|
+ String lang = commonService.getLanguage(request);
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ List<HotelBrandDto> hotelBrands = null;// 酒店主品牌
|
|
|
+ List<DPResp> international = null;// 国际区分
|
|
|
+ List<PhoneCodeResp> phoneCode = null;// 国家码
|
|
|
+ // 判断redis中的基础数据是否过期
|
|
|
+ if(!redisDao.hasKey("departmentsAndPositions_en")) {
|
|
|
+ init.init();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ if(lang.equalsIgnoreCase("en")) {
|
|
|
+ hotelBrands = redisHotelBrandDao.selectMessageInfo("hotelBrands_en");
|
|
|
+ international = redisDPResp.selectMessageInfo("international_en");
|
|
|
+ phoneCode = redisPhoneCodeResp.selectMessageInfo("phoneCode_en");
|
|
|
+ }else {
|
|
|
+ hotelBrands = redisHotelBrandDao.selectMessageInfo("hotelBrands_cn");
|
|
|
+ international = redisDPResp.selectMessageInfo("international_cn");
|
|
|
+ phoneCode = redisPhoneCodeResp.selectMessageInfo("phoneCode_cn");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ hotelBrands = mdeHotelBrandService.getAllHotelInternational(lang);// 酒店主品牌
|
|
|
+ international = commonService.getDictByType("international",lang);// 国际区分
|
|
|
+ phoneCode = commonService.getPhoneCode("phone_code", lang);// 国家码
|
|
|
+ }
|
|
|
+ map.put("hotelBrands", hotelBrands);
|
|
|
+ map.put("international", international);
|
|
|
+ map.put("phoneCode", phoneCode);
|
|
|
+ return new ResultEntity<Map<String, Object>>(InfoMsg.SUCCESS_REQUEST, map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取基础数据-填写工作经验
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getBaseDataForExp", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<Map<String, Object>> getBaseDataForExp(HttpServletRequest request) {
|
|
|
+ String lang = commonService.getLanguage(request);
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ List<HotelCompanyResp> hotelCompanys = null;// 酒店公司
|
|
|
+ List<LVResp> schoolList = null;// 学校列表
|
|
|
+ List<DPResp> education = null;// 学历
|
|
|
+ // 判断redis中的基础数据是否过期
|
|
|
+ if(!redisDao.hasKey("departmentsAndPositions_en")) {
|
|
|
+ init.init();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ hotelCompanys = redisHotelCompanyDao.selectMessageInfo("hotelCompanys");
|
|
|
+ if(lang.equalsIgnoreCase("en")) {
|
|
|
+ schoolList = redisLVResp.selectMessageInfo("schoolList_en");
|
|
|
+ education = redisDPResp.selectMessageInfo("education_en");
|
|
|
+ }else {
|
|
|
+ schoolList = redisLVResp.selectMessageInfo("schoolList_cn");
|
|
|
+ education = redisDPResp.selectMessageInfo("education_cn");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ hotelCompanys = mdeHotelCompanyService.getAllHotelCompanyInternational();// 酒店公司
|
|
|
+ schoolList = commonService.getSchoolList(lang);// 学校列表
|
|
|
+ education = commonService.getDictByType("education",lang);// 学历
|
|
|
+ }
|
|
|
+ map.put("hotelCompanys", hotelCompanys);
|
|
|
+ map.put("schoolList", schoolList);
|
|
|
+ map.put("education", education);
|
|
|
+ return new ResultEntity<Map<String, Object>>(InfoMsg.SUCCESS_REQUEST, map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 酒店品牌列表(主)
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getAllHotelInternational", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public List<HotelBrandDto> getAllHotelInternational(HttpServletRequest req, HttpServletResponse resp) {
|
|
|
+ String language = commonService.getLanguage(req);
|
|
|
+ return mdeHotelBrandService.getAllHotelInternational(language);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 酒店品牌列表(子)
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getAllHotelSubInternational", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public List<HotelSubBrandDto> getAllHotelSubBrandInternational(HttpServletRequest req, HttpServletResponse resp) {
|
|
|
+ String language = commonService.getLanguage(req);
|
|
|
+ return mdeHotelSubBrandService.getAllHotelSubBrandInternational(language);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导入 省市 json 数据
|
|
|
+ * @param req
|
|
|
+ * @param resp
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+// @RequestMapping(value = "getaaa", method = RequestMethod.POST)
|
|
|
+// @ResponseBody
|
|
|
+// public String getaaa(HttpServletRequest req, HttpServletResponse resp) {
|
|
|
+// String language = commonService.getLanguage(req);
|
|
|
+// return areaService.importEn();
|
|
|
+// }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 文件下载
|
|
|
+ *
|
|
|
+ * @param filePath
|
|
|
+ * @param response
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/downloadFile", method = RequestMethod.GET)
|
|
|
+ public void downloadFile(@RequestParam String filePath, HttpServletResponse response) throws Exception {
|
|
|
+
|
|
|
+ InputStream in = null;
|
|
|
+ OutputStream os = null;
|
|
|
+ try {
|
|
|
+ if(filePath.indexOf(domainUrl)>=0) {
|
|
|
+ filePath = filePath.substring(filePath.indexOf(domainUrl)+domainUrl.length());
|
|
|
+ }
|
|
|
+ // 获取文件
|
|
|
+ File file = new File(basePackagePath + filePath);
|
|
|
+ if (!file.exists()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 设置 返回消息
|
|
|
+ response.setContentType("application/octet-stream; charset=utf-8");// application/bytes
|
|
|
+ // application/octet-stream video/mp4
|
|
|
+ response.setHeader("Content-Disposition", "inline;fileName=" + URLEncoder.encode(filePath, "utf-8"));
|
|
|
+ response.addHeader("Content-Length", "" + file.length());
|
|
|
+ in = new FileInputStream(file);
|
|
|
+ os = response.getOutputStream();
|
|
|
+ byte[] b = new byte[2048];
|
|
|
+ int length;
|
|
|
+ while ((length = in.read(b)) > 0) {
|
|
|
+ os.write(b, 0, length);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("文件下载异常",e);
|
|
|
+ e.fillInStackTrace();
|
|
|
+ } finally {
|
|
|
+ if (in != null)
|
|
|
+ in.close();
|
|
|
+ if (os != null)
|
|
|
+ os.close();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 可能认识的人
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getMaybeFriends")
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<List<MdeUser>> getMaybeFriends (HttpServletRequest req) {
|
|
|
+ String userCode = commonService.getUserCode(req);
|
|
|
+ String identityFlag = commonService.getIdentityFlag(req);
|
|
|
+ String lang = commonService.getLanguage(req);
|
|
|
+ List<MdeUser> maybeFriends = commonService.getMaybeFriends(userCode,identityFlag,lang);
|
|
|
+ return new ResultEntity<>(InfoMsg.SUCCESS_REQUEST,maybeFriends);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 优选人才列表
|
|
|
+ *
|
|
|
+ * @param req
|
|
|
+ * @param resp
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getRecommentPeople", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<List<MdeUser>> getRecommentPeople(HttpServletRequest req, HttpServletResponse resp) {
|
|
|
+ List<MdeUser> recommentPeoplListe = commonService.getRecommentPeople(commonService.getUserCode(req));
|
|
|
+ return new ResultEntity<List<MdeUser>>(InfoMsg.SUCCESS_REQUEST, recommentPeoplListe);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 可能认识的人
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getMaybeFriend", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<List<MdeUser>> getMaybeFriend(HttpServletRequest req, HttpServletResponse resp) {
|
|
|
+ String userCode = commonService.getUserCode(req);
|
|
|
+ String identityFlag = commonService.getIdentityFlag(req);
|
|
|
+ String lang = commonService.getLanguage(req);
|
|
|
+ List<MdeUser> recommentPeoplListe = commonService.getMaybeFriends(userCode,identityFlag,lang);
|
|
|
+ return new ResultEntity<List<MdeUser>>(InfoMsg.SUCCESS_REQUEST, recommentPeoplListe);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取学校列表
|
|
|
+ *
|
|
|
+ * @param req
|
|
|
+ * @param resp
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getSchoolList", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<List<LVResp>> getSchoolList(HttpServletRequest request) {
|
|
|
+ String lang = commonService.getLanguage(request);
|
|
|
+ List<LVResp> list = commonService.getSchoolList(lang);
|
|
|
+ return new ResultEntity<List<LVResp>>(InfoMsg.SUCCESS_REQUEST, list);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取广告图片
|
|
|
+ * @param request
|
|
|
+ * @param adType
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getAdImage", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<List<AdImageDto>> getAdImage(HttpServletRequest request,@RequestParam String adType) {
|
|
|
+ List<AdImageDto> list = commonService.getAdImages(adType);
|
|
|
+ return new ResultEntity<List<AdImageDto>>(InfoMsg.SUCCESS_REQUEST, list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 记录广告浏览历史
|
|
|
+ * @param request
|
|
|
+ * @param adId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "lookOverAd", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<Integer> lookOverAd(HttpServletRequest request,@RequestBody AdReq adReq) {
|
|
|
+ return new ResultEntity<Integer>(InfoMsg.SUCCESS_REQUEST, commonService.lookOverAd(adReq));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 清除基础数据缓存
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "resetBaseData", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<Integer> resetBaseData(HttpServletRequest request,@RequestParam String mm) {
|
|
|
+ //密码验证
|
|
|
+ if(Md5Utils.EncoderPassword("B5oT$6X&oqAjcrvO").endsWith(mm)){
|
|
|
+ redisDao.delete("departmentsAndPositions_en");
|
|
|
+ return new ResultEntity<Integer>(InfoMsg.SUCCESS_REQUEST);
|
|
|
+ }
|
|
|
+ return new ResultEntity<Integer>(InfoMsg.ERROR_EMPTY_REQUEST);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取登陆首页广告图片
|
|
|
+ * @param request
|
|
|
+ * @param adType
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getLoginAdImage", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<OpenAdResq> getLoginAdImage() {
|
|
|
+ OpenAdResq resp = new OpenAdResq();
|
|
|
+ List<AdImageDto> pcList = new ArrayList<AdImageDto>();
|
|
|
+ List<AdImageDto> sjList = new ArrayList<AdImageDto>();
|
|
|
+ AdImageDto adDto = commonService.getAdImage(Constants.PC_OPEN_CN);
|
|
|
+ pcList.add(adDto);
|
|
|
+ pcList.add(commonService.getAdImage(Constants.PC_OPEN_EN));
|
|
|
+ sjList.add(commonService.getAdImage(Constants.SJ_OPEN_CN));
|
|
|
+ sjList.add(commonService.getAdImage(Constants.SJ_OPEN_EN));
|
|
|
+ if(adDto.getUpdateDate() != null)
|
|
|
+ {
|
|
|
+ resp.setAdCode(String.valueOf(adDto.getUpdateDate().getTime()));
|
|
|
+ }
|
|
|
+ resp.setAdListPc(pcList);
|
|
|
+ resp.setAdListPhone(sjList);
|
|
|
+
|
|
|
+ return new ResultEntity<OpenAdResq>(InfoMsg.SUCCESS_REQUEST, resp);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取部门和职位
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getDepartmentsAndPositions", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<Map<String, Object>> getPositions(HttpServletRequest request) {
|
|
|
+ String lang = commonService.getLanguage(request);
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ String departmentsAndPositions = null;// 部门职位
|
|
|
+ // 判断redis中的基础数据是否过期
|
|
|
+ if(!redisDao.hasKey("departmentsAndPositions_en")) {
|
|
|
+ init.init();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ if(lang.equalsIgnoreCase("en")) {
|
|
|
+ departmentsAndPositions = redisDao.select("departmentsAndPositions_en");
|
|
|
+ }else {
|
|
|
+ departmentsAndPositions = redisDao.select("departmentsAndPositions_cn");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ departmentsAndPositions = commonService.getDepartmentsAndPositions(lang);// 部门职位
|
|
|
+ }
|
|
|
+ map.put("departmentsAndPositions", departmentsAndPositions);
|
|
|
+ return new ResultEntity<Map<String, Object>>(InfoMsg.SUCCESS_REQUEST, map);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取省市区
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getProvinceCityArea", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<Map<String, Object>> getProvinceCityArea(HttpServletRequest request) {
|
|
|
+ String lang = commonService.getLanguage(request);
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ List<Province> provinceCityArea = null;// 省市区
|
|
|
+ List<Province> provinceCity = null;// 省市
|
|
|
+ // 判断redis中的基础数据是否过期
|
|
|
+ if(!redisDao.hasKey("departmentsAndPositions_en")) {
|
|
|
+ init.init();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ if(lang.equalsIgnoreCase("en")) {
|
|
|
+ provinceCityArea = redisProvinceCityDao.selectMessageInfo("provinceCityArea_en");
|
|
|
+ provinceCity = redisProvinceCityDao.selectMessageInfo("provinceCity_en");
|
|
|
+ }else {
|
|
|
+ provinceCityArea = redisProvinceCityDao.selectMessageInfo("provinceCityArea_cn");
|
|
|
+ provinceCity = redisProvinceCityDao.selectMessageInfo("provinceCity_cn");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ provinceCityArea = areaService.getAllArea(lang);// 省市区
|
|
|
+ provinceCity = areaService.getAllProvinceAndCity(lang);// 省市
|
|
|
+ }
|
|
|
+ map.put("provinceCityArea", provinceCityArea);
|
|
|
+ map.put("provinceCity", provinceCity);
|
|
|
+ return new ResultEntity<Map<String, Object>>(InfoMsg.SUCCESS_REQUEST, map);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取酒店公司名称
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getHotelCompanys", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<Map<String, Object>> getHotelCompanys(HttpServletRequest request) {
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ List<HotelCompanyResp> hotelCompanys = null;// 酒店公司
|
|
|
+ // 判断redis中的基础数据是否过期
|
|
|
+ if(!redisDao.hasKey("departmentsAndPositions_en")) {
|
|
|
+ init.init();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ hotelCompanys = redisHotelCompanyDao.selectMessageInfo("hotelCompanys");
|
|
|
+ } catch (Exception e) {
|
|
|
+ hotelCompanys = mdeHotelCompanyService.getAllHotelCompanyInternational();// 酒店公司
|
|
|
+ }
|
|
|
+ map.put("hotelCompanys", hotelCompanys);
|
|
|
+ return new ResultEntity<Map<String, Object>>(InfoMsg.SUCCESS_REQUEST, map);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取酒店品牌
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getHotelBrands", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<Map<String, Object>> getHotelBrands(HttpServletRequest request) {
|
|
|
+ String lang = commonService.getLanguage(request);
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ List<HotelBrandDto> hotelBrands = null;// 酒店主品牌
|
|
|
+ List<HotelSubBrandDto> hotelSubBrands = null;// 酒店子品牌
|
|
|
+ // 判断redis中的基础数据是否过期
|
|
|
+ if(!redisDao.hasKey("departmentsAndPositions_en")) {
|
|
|
+ init.init();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ if(lang.equalsIgnoreCase("en")) {
|
|
|
+ hotelBrands = redisHotelBrandDao.selectMessageInfo("hotelBrands_en");
|
|
|
+ hotelSubBrands = redisHotelSubBrandDao.selectMessageInfo("hotelSubBrands_en");
|
|
|
+ }else {
|
|
|
+ hotelBrands = redisHotelBrandDao.selectMessageInfo("hotelBrands_cn");
|
|
|
+ hotelSubBrands = redisHotelSubBrandDao.selectMessageInfo("hotelSubBrands_cn");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ hotelBrands = mdeHotelBrandService.getAllHotelInternational(lang);// 酒店主品牌
|
|
|
+ hotelSubBrands = mdeHotelSubBrandService.getAllHotelSubBrandInternational(lang);// 酒店子品牌
|
|
|
+ }
|
|
|
+ map.put("hotelBrands", hotelBrands);
|
|
|
+ map.put("hotelSubBrands", hotelSubBrands);
|
|
|
+ return new ResultEntity<Map<String, Object>>(InfoMsg.SUCCESS_REQUEST, map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取工作年限和学历
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getWorkYearAndEducation", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<Map<String, Object>> getWorkYearAndEducation(HttpServletRequest request) {
|
|
|
+ String lang = commonService.getLanguage(request);
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ List<DPResp> workYear = null;// 工作年限
|
|
|
+ List<DPResp> education = null;// 学历
|
|
|
+ // 判断redis中的基础数据是否过期
|
|
|
+ if(!redisDao.hasKey("departmentsAndPositions_en")) {
|
|
|
+ init.init();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ if(lang.equalsIgnoreCase("en")) {
|
|
|
+ workYear = redisDPResp.selectMessageInfo("workYear_en");
|
|
|
+ education = redisDPResp.selectMessageInfo("education_en");
|
|
|
+ }else {
|
|
|
+ workYear = redisDPResp.selectMessageInfo("workYear_cn");
|
|
|
+ education = redisDPResp.selectMessageInfo("education_cn");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ workYear = commonService.getDictByType("job_year",lang);// 工作年限
|
|
|
+ education = commonService.getDictByType("education",lang);// 学历
|
|
|
+ }
|
|
|
+ map.put("workYear", workYear);
|
|
|
+ map.put("education", education);
|
|
|
+ return new ResultEntity<Map<String, Object>>(InfoMsg.SUCCESS_REQUEST, map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取简历投递状态
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getCvStatus", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<Map<String, Object>> getCvStatus(HttpServletRequest request) {
|
|
|
+ String lang = commonService.getLanguage(request);
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ List<DPResp> cvStatus = null;// 简历投递状态
|
|
|
+ // 判断redis中的基础数据是否过期
|
|
|
+ if(!redisDao.hasKey("departmentsAndPositions_en")) {
|
|
|
+ init.init();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ if(lang.equalsIgnoreCase("en")) {
|
|
|
+ cvStatus = redisDPResp.selectMessageInfo("cvStatus_en");
|
|
|
+ }else {
|
|
|
+ cvStatus = redisDPResp.selectMessageInfo("cvStatus_cn");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ cvStatus = commonService.getDictByType("cv_status",lang);// 简历投递状态
|
|
|
+ }
|
|
|
+ map.put("cvStatus", cvStatus);
|
|
|
+ return new ResultEntity<Map<String, Object>>(InfoMsg.SUCCESS_REQUEST, map);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取标准时间
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getStandardTime", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public Date getStandardTime(HttpServletRequest request) {
|
|
|
+ return new Date();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取拉新活动id
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getActId", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<String> getActId(HttpServletRequest request) {
|
|
|
+ ResultEntity<String> rest = new ResultEntity<String>();
|
|
|
+ String actId = commonService.getActId();
|
|
|
+ if(StringsUtils.isEmpty(actId))
|
|
|
+ {
|
|
|
+ rest.setMsg(InfoMsg.ERROR_SYSTEM_ERROR);
|
|
|
+ }
|
|
|
+ rest.setResult(actId);
|
|
|
+ return rest;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取职位详情底部广告图片
|
|
|
+ * @param request
|
|
|
+ * @param adType
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getAdOfJobDtl", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<List<AdImageDto>> getAdOfJobDtl(HttpServletRequest request,@RequestParam String adType) {
|
|
|
+
|
|
|
+ List<AdImageDto> list = new ArrayList<AdImageDto>();
|
|
|
+ if(Constants.SJ_POSITION_DTL.equals(adType) || Constants.PC_POSITION_DETAIL_BOTTOM_AD.equals(adType))
|
|
|
+ {
|
|
|
+ list = commonService.getAdImages(adType);
|
|
|
+ }
|
|
|
+
|
|
|
+ return new ResultEntity<List<AdImageDto>>(InfoMsg.SUCCESS_REQUEST, list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取酒店类型下拉列表
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getPrepareFlagList", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<List<DPResp>> getPrepareFlagList(HttpServletRequest request) {
|
|
|
+ ResultEntity<List<DPResp>> rest = new ResultEntity<List<DPResp>>();
|
|
|
+ List<DPResp> prepareFlagList = commonService.getDictByType("prepare_flag",request);
|
|
|
+ rest.setResult(prepareFlagList);
|
|
|
+ return rest;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取职位发布时间下拉列表
|
|
|
+ *
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "getPositionPubTList", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<List<DPResp>> getPositionPubTList(HttpServletRequest request) {
|
|
|
+ ResultEntity<List<DPResp>> rest = new ResultEntity<List<DPResp>>();
|
|
|
+ List<DPResp> prepareFlagList = commonService.getDictByType("position_publish_time",request);
|
|
|
+ rest.setResult(prepareFlagList);
|
|
|
+ return rest;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 广告点击量记录
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value="setAdCtrs", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public ResultEntity<String> setAdCtrs(@RequestBody List<AdCtrReq> adCtrReqList,HttpServletRequest request){
|
|
|
+ ResultEntity<String> rest = new ResultEntity<String>();
|
|
|
+ int result = 0;
|
|
|
+ for(AdCtrReq adCtrReq : adCtrReqList) {
|
|
|
+ //记录广告点击率
|
|
|
+ result = result+ adImagesService.recodeAdCtr(adCtrReq);
|
|
|
+ }
|
|
|
+ if(result > 0) {
|
|
|
+ rest.setMsg(InfoMsg.ERROR_SAVE_FIELD);
|
|
|
+ };
|
|
|
+
|
|
|
+ return rest;
|
|
|
+ }
|
|
|
+}
|