|
@@ -0,0 +1,286 @@
|
|
|
|
+package com.jpsoft.employment.modules.mobile.controller;
|
|
|
|
+
|
|
|
|
+import com.github.pagehelper.Page;
|
|
|
|
+import com.jpsoft.employment.modules.base.entity.*;
|
|
|
|
+import com.jpsoft.employment.modules.base.service.*;
|
|
|
|
+import com.jpsoft.employment.modules.common.dto.MessageResult;
|
|
|
|
+import com.jpsoft.employment.modules.common.dto.Sort;
|
|
|
|
+import com.jpsoft.employment.modules.common.utils.PojoUtils;
|
|
|
|
+import com.jpsoft.employment.modules.sys.service.DataDictionaryService;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
|
+import org.springframework.data.redis.core.ValueOperations;
|
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
+
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+
|
|
|
|
+@Slf4j
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("/mobile/news")
|
|
|
|
+@Api(description = "新闻等信息")
|
|
|
|
+public class NewsApiController {
|
|
|
|
+ @Value("${jwt.secret}")
|
|
|
|
+ private String jwtSecret;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ RabbitTemplate rabbitTemplate;
|
|
|
|
+ @Autowired
|
|
|
|
+ private DataDictionaryService dataDictionaryService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ValueOperations<String, Object> valueOperations;
|
|
|
|
+ @Autowired
|
|
|
|
+ private PersonInfoService personInfoService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private RecruitInformationInfoService recruitInformationInfoService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private JobInformationInfoService jobInformationInfoService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private NewsInfoService newsInfoService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ShareWorksInfoService shareWorksInfoService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private TrainingInfoService trainingInfoService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private EnterpriseInfoService enterpriseInfoService;
|
|
|
|
+
|
|
|
|
+ @PostMapping("newsList")
|
|
|
|
+ @ApiOperation(value = " 新闻政策发布,爱心驿站,招聘新闻")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "category", value = "新闻类型字典:政策发布1,招聘新闻2,爱心驿站3(默认1", required = false, paramType = "form"),
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Map> newsList(
|
|
|
|
+ @RequestParam(value = "category", defaultValue = "1") String category,
|
|
|
|
+ @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
|
+
|
|
|
|
+ searchParams.put("category",category);
|
|
|
|
+
|
|
|
|
+ Page<NewsInfo> page = newsInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
+
|
|
|
|
+ for (NewsInfo newsInfo:page) {
|
|
|
|
+ newsInfo.setCategoryN(dataDictionaryService.findNameByCatalogNameAndValue("新闻类型",newsInfo.getCategory()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
|
+
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage());
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("newsDetail")
|
|
|
|
+ @ApiOperation(value = " 新闻详细")
|
|
|
|
+ public MessageResult<Map> newsDetail(
|
|
|
|
+ @RequestParam(value = "id", defaultValue = "") String id) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+ try {
|
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
+ Map<String,Object> returnMap = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ NewsInfo newsInfo = newsInfoService.get(id);
|
|
|
|
+ if(newsInfo == null){
|
|
|
|
+ throw new Exception("未找到新闻");
|
|
|
|
+ }
|
|
|
|
+ newsInfo.setCategoryN(dataDictionaryService.findNameByCatalogNameAndValue("新闻类型",newsInfo.getCategory()));
|
|
|
|
+
|
|
|
|
+ returnMap.put("newsInfo",newsInfo);
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(returnMap);
|
|
|
|
+
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage());
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("shareWorksList")
|
|
|
|
+ @ApiOperation(value = " 共享用工")
|
|
|
|
+ @ApiImplicitParams({
|
|
|
|
+ @ApiImplicitParam(name = "type", value = "字典:急需用工1,资源共享2,默认1", required = false, paramType = "form"),
|
|
|
|
+ })
|
|
|
|
+ public MessageResult<Map> shareWorksList(
|
|
|
|
+ @RequestParam(value = "type", defaultValue = "1") String type,
|
|
|
|
+ @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
|
+ if(StringUtils.isNotEmpty(type)){
|
|
|
|
+ searchParams.put("type",type);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ searchParams.put("status","1");
|
|
|
|
+ Page<ShareWorksInfo> page = shareWorksInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
+
|
|
|
|
+ for (ShareWorksInfo shareWorksInfo:page) {
|
|
|
|
+ shareWorksInfo.setTypeN(dataDictionaryService.findNameByCatalogNameAndValue("共享用工类型",shareWorksInfo.getType()));
|
|
|
|
+ }
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
|
+
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage());
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("shareWorksDetail")
|
|
|
|
+ @ApiOperation(value = " 共享用工详细")
|
|
|
|
+ public MessageResult<Map> shareWorksDetail(
|
|
|
|
+ @RequestParam(value = "id", defaultValue = "") String id) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+ try {
|
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
+ Map<String,Object> returnMap = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ ShareWorksInfo shareWorksInfo = shareWorksInfoService.get(id);
|
|
|
|
+ if(shareWorksInfo == null){
|
|
|
|
+ throw new Exception("未找到内容");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ shareWorksInfo.setTypeN(dataDictionaryService.findNameByCatalogNameAndValue("共享用工类型",shareWorksInfo.getType()));
|
|
|
|
+
|
|
|
|
+ returnMap.put("shareWorksInfo",shareWorksInfo);
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(returnMap);
|
|
|
|
+
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage());
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("trainingList")
|
|
|
|
+ @ApiOperation(value = "技能培训")
|
|
|
|
+ public MessageResult<Map> trainingList(
|
|
|
|
+ @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex,
|
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ Map<String,Object> searchParams = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
+ sortList.add(new Sort("create_time","desc"));
|
|
|
|
+
|
|
|
|
+ searchParams.put("status","1");
|
|
|
|
+ Page<TrainingInfo> page = trainingInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
|
+
|
|
|
|
+ for (TrainingInfo trainingInfo:page) {
|
|
|
|
+ EnterpriseInfo enterpriseInfo = enterpriseInfoService.get(trainingInfo.getEnterpriseId());
|
|
|
|
+ if(enterpriseInfo!=null){
|
|
|
|
+ trainingInfo.setEnterpriseName(enterpriseInfo.getName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(PojoUtils.pageWrapper(page));
|
|
|
|
+
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage());
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("trainingDetail")
|
|
|
|
+ @ApiOperation(value = "技能培训详细")
|
|
|
|
+ public MessageResult<Map> trainingDetail(
|
|
|
|
+ @RequestParam(value = "id", defaultValue = "") String id) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+ try {
|
|
|
|
+ MessageResult<Map> msgResult = new MessageResult<>();
|
|
|
|
+ Map<String,Object> returnMap = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ TrainingInfo trainingInfo = trainingInfoService.get(id);
|
|
|
|
+ if(trainingInfo == null){
|
|
|
|
+ throw new Exception("未找到内容");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ EnterpriseInfo enterpriseInfo = enterpriseInfoService.get(trainingInfo.getEnterpriseId());
|
|
|
|
+ if(enterpriseInfo!=null){
|
|
|
|
+ trainingInfo.setEnterpriseName(enterpriseInfo.getName());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ returnMap.put("trainingInfo",trainingInfo);
|
|
|
|
+
|
|
|
|
+ msgResult.setResult(true);
|
|
|
|
+ msgResult.setData(returnMap);
|
|
|
|
+
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage());
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+}
|