|
|
@@ -1,20 +1,23 @@
|
|
|
package com.jpsoft.employment.modules.mobile.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import com.jpsoft.employment.config.OSSConfig;
|
|
|
import com.jpsoft.employment.modules.base.entity.MessageNotice;
|
|
|
+import com.jpsoft.employment.modules.base.entity.MessageRead;
|
|
|
import com.jpsoft.employment.modules.base.entity.UserAuthenticationApprove;
|
|
|
import com.jpsoft.employment.modules.base.service.MessageNoticeService;
|
|
|
+import com.jpsoft.employment.modules.base.service.MessageReadService;
|
|
|
import com.jpsoft.employment.modules.base.service.UserAuthenticationApproveService;
|
|
|
import com.jpsoft.employment.modules.common.dto.MessageResult;
|
|
|
import com.jpsoft.employment.modules.common.dto.Sort;
|
|
|
import com.jpsoft.employment.modules.common.utils.*;
|
|
|
-import com.jpsoft.employment.modules.job.entity.JobUser;
|
|
|
-import com.jpsoft.employment.modules.job.service.JobUserService;
|
|
|
-import com.jpsoft.employment.modules.job.service.ResumeDeliverService;
|
|
|
-import com.jpsoft.employment.modules.job.service.ResumeService;
|
|
|
-import com.jpsoft.employment.modules.job.service.UserCollectionService;
|
|
|
+import com.jpsoft.employment.modules.job.dto.EducationExpDTO;
|
|
|
+import com.jpsoft.employment.modules.job.dto.ExpJsonDTO;
|
|
|
+import com.jpsoft.employment.modules.job.dto.WorkExpDTO;
|
|
|
+import com.jpsoft.employment.modules.job.entity.*;
|
|
|
+import com.jpsoft.employment.modules.job.service.*;
|
|
|
import com.jpsoft.employment.modules.sys.entity.DataDictionary;
|
|
|
import com.jpsoft.employment.modules.sys.entity.SysLog;
|
|
|
import com.jpsoft.employment.modules.sys.entity.User;
|
|
|
@@ -33,6 +36,7 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.redis.core.ValueOperations;
|
|
|
+import org.springframework.format.annotation.DateTimeFormat;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
import sun.misc.BASE64Decoder;
|
|
|
@@ -72,6 +76,24 @@ public class MessageNoticeApiController {
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ResumeDeliverContentService resumeDeliverContentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WorkCategoryService workCategoryService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResumeService resumeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MessageReadService messageReadService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResumeDeliverService resumeDeliverService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ResumeDeliverRecordService resumeDeliverRecordService;
|
|
|
+
|
|
|
|
|
|
@PostMapping("messageClassify")
|
|
|
@ApiOperation(value = "消息分类")
|
|
|
@@ -86,19 +108,55 @@ public class MessageNoticeApiController {
|
|
|
if (jobUser == null) {
|
|
|
throw new Exception("未登录!");
|
|
|
}
|
|
|
- List<DataDictionary> ddList = dataDictionaryService.findByCatalogName("消息分类");
|
|
|
+ //List<DataDictionary> ddList = dataDictionaryService.findByCatalogName("消息分类");
|
|
|
+// 系统消息1
|
|
|
+// 求职消息2
|
|
|
+// 政策发布3
|
|
|
+// 推荐职位4--求职者
|
|
|
+// 推荐简历5--HR
|
|
|
+ int classifyNum = 5;
|
|
|
+ for(int i = 1;i<=classifyNum;i++){
|
|
|
+ if(i == 1){
|
|
|
+ Map<String, Object> mnMap = new HashMap<>();
|
|
|
+ MessageNotice mn = messageNoticeService.findTopByUserIdAndClassify(jobUser.getId(),"1");
|
|
|
+ mnMap.put("classify","系统消息");
|
|
|
+ mnMap.put("classifyId","1");
|
|
|
+ mnMap.put("newMessage",mn);
|
|
|
+ mnMap.put("num",0);
|
|
|
+
|
|
|
+ resultList.add(mnMap);
|
|
|
+ }else if(i == 2){
|
|
|
+ Map<String, Object> mnMap = new HashMap<>();
|
|
|
+ //job_resume_deliver_content
|
|
|
+ ResumeDeliverContent rdc = resumeDeliverContentService.findTopByUserId(jobUser.getId());
|
|
|
+
|
|
|
+ mnMap.put("classify","求职消息");
|
|
|
+ mnMap.put("classifyId","2");
|
|
|
+ mnMap.put("newMessage",rdc);
|
|
|
+ mnMap.put("num",0);
|
|
|
+
|
|
|
+ resultList.add(mnMap);
|
|
|
+ }else if(i == 3){
|
|
|
+ Map<String, Object> mnMap = new HashMap<>();
|
|
|
+ MessageNotice mn = messageNoticeService.findTopByUserIdAndClassify(jobUser.getId(),"3");
|
|
|
+ mnMap.put("classify","政策发布");
|
|
|
+ mnMap.put("classifyId","3");
|
|
|
+ mnMap.put("newMessage",mn);
|
|
|
+ mnMap.put("num",0);
|
|
|
+
|
|
|
+ resultList.add(mnMap);
|
|
|
+ }else if(i == 4){
|
|
|
+ Map<String, Object> mnMap = new HashMap<>();
|
|
|
+
|
|
|
+ mnMap.put("classify","推荐职位");
|
|
|
+ mnMap.put("classifyId","4");
|
|
|
+ mnMap.put("newMessage","");
|
|
|
+ mnMap.put("num",0);
|
|
|
+
|
|
|
+ resultList.add(mnMap);
|
|
|
+ }
|
|
|
|
|
|
- for(DataDictionary dd :ddList){
|
|
|
- Map<String, Object> mnMap = new HashMap<>();
|
|
|
- MessageNotice mn = messageNoticeService.findTopByUserIdAndClassify(subject,dd.getValue());
|
|
|
- mnMap.put("classify",dd.getName());
|
|
|
- mnMap.put("classifyId",dd.getValue());
|
|
|
- mnMap.put("newMessage",mn);
|
|
|
- mnMap.put("num",0);
|
|
|
-
|
|
|
- resultList.add(mnMap);
|
|
|
}
|
|
|
-
|
|
|
messageResult.setData(resultList);
|
|
|
messageResult.setResult(true);
|
|
|
messageResult.setCode(200);
|
|
|
@@ -150,10 +208,12 @@ public class MessageNoticeApiController {
|
|
|
page = messageNoticeService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
}else if("1".equals(classifyId)){
|
|
|
//1系统消息
|
|
|
+ page = messageNoticeService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
}else if("2".equals(classifyId)){
|
|
|
//2求职信息
|
|
|
+ page = messageNoticeService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
|
|
|
}else if("4".equals(classifyId)){
|
|
|
- //4推荐职位
|
|
|
+ //4推荐职位 no
|
|
|
}
|
|
|
|
|
|
messageResult.setData(PojoUtils.pageWrapper(page));
|
|
|
@@ -173,11 +233,11 @@ public class MessageNoticeApiController {
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "messageId", value = "消息ID", required = true, paramType = "query"),
|
|
|
})
|
|
|
- public MessageResult<MessageNotice> messageDetail(
|
|
|
+ public MessageResult<Map> messageDetail(
|
|
|
String messageId,
|
|
|
String token,
|
|
|
@RequestAttribute String subject) {
|
|
|
- MessageResult<MessageNotice> messageResult = new MessageResult<>();
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
|
JobUser jobUser = jobUserService.get(subject);
|
|
|
@@ -194,7 +254,42 @@ public class MessageNoticeApiController {
|
|
|
User createUser = userService.get(mc.getCreateBy());
|
|
|
mc.setCreateByN(createUser.getRealName());
|
|
|
|
|
|
- messageResult.setData(mc);
|
|
|
+ MessageRead messageRead = messageReadService.findByMIdAndUserId(mc.getId(),subject);
|
|
|
+ Boolean isNeedAgree = false;
|
|
|
+ Boolean isAgree = false;
|
|
|
+ if(messageRead == null){
|
|
|
+ messageRead = new MessageRead();
|
|
|
+ messageRead.setId(UUID.randomUUID().toString());
|
|
|
+ messageRead.setCreateBy(subject);
|
|
|
+ messageRead.setCreateTime(new Date());
|
|
|
+ messageRead.setDelFlag(false);
|
|
|
+ messageRead.setMessageId(mc.getId());
|
|
|
+ messageRead.setUserId(subject);
|
|
|
+ messageRead.setIsRead(true);
|
|
|
+ messageRead.setIsAgree(false);
|
|
|
+ messageReadService.insert(messageRead);
|
|
|
+ isAgree = messageRead.getIsAgree();
|
|
|
+ }else{
|
|
|
+ messageRead.setUpdateBy(subject);
|
|
|
+ messageRead.setUpdateTime(new Date());
|
|
|
+ messageRead.setIsRead(true);
|
|
|
+ if(messageRead.getIsAgree() == null){
|
|
|
+ messageRead.setIsAgree(false);
|
|
|
+ }
|
|
|
+ messageReadService.update(messageRead);
|
|
|
+ isAgree = messageRead.getIsAgree();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(mc.getIsNeedAgree() != null){
|
|
|
+ isNeedAgree = mc.getIsNeedAgree();
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Object> returnMap = new HashMap<>();
|
|
|
+ returnMap.put("messageDetail",mc);
|
|
|
+ returnMap.put("isNeedAgree",isNeedAgree);
|
|
|
+ returnMap.put("isAgree",isAgree);
|
|
|
+
|
|
|
+ messageResult.setData(returnMap);
|
|
|
messageResult.setResult(true);
|
|
|
messageResult.setCode(200);
|
|
|
} catch (Exception ex) {
|
|
|
@@ -206,4 +301,79 @@ public class MessageNoticeApiController {
|
|
|
return messageResult;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ @PostMapping("changeAgree")
|
|
|
+ @ApiOperation(value = "用户是否同意")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "messageId", value = "消息ID", paramType = "query"),
|
|
|
+ @ApiImplicitParam(name = "isAgree", value = "是否同意", paramType = "query"),
|
|
|
+ })
|
|
|
+ public MessageResult<String> changeAgree(
|
|
|
+ @RequestParam(value="messageId",defaultValue="") String messageId,
|
|
|
+ Boolean isAgree,
|
|
|
+ String token,
|
|
|
+ @RequestAttribute String subject) {
|
|
|
+ MessageResult<String> messageResult = new MessageResult<>();
|
|
|
+
|
|
|
+ try {
|
|
|
+
|
|
|
+ MessageNotice messageNotice = messageNoticeService.get(messageId);
|
|
|
+ if(messageNotice == null){
|
|
|
+ throw new Exception("查询消息错误!");
|
|
|
+ }
|
|
|
+ MessageRead messageRead = messageReadService.findByMIdAndUserId(messageId,subject);
|
|
|
+ if(messageRead == null){
|
|
|
+ messageRead = new MessageRead();
|
|
|
+ messageRead.setId(UUID.randomUUID().toString());
|
|
|
+ messageRead.setCreateBy(subject);
|
|
|
+ messageRead.setCreateTime(new Date());
|
|
|
+ messageRead.setDelFlag(false);
|
|
|
+ messageRead.setMessageId(messageId);
|
|
|
+ messageRead.setUserId(subject);
|
|
|
+ messageRead.setIsRead(true);
|
|
|
+ messageRead.setIsAgree(isAgree);
|
|
|
+ messageReadService.insert(messageRead);
|
|
|
+ }else{
|
|
|
+ messageRead.setUpdateBy(subject);
|
|
|
+ messageRead.setUpdateTime(new Date());
|
|
|
+ messageRead.setIsRead(true);
|
|
|
+ messageRead.setIsAgree(isAgree);
|
|
|
+ messageReadService.update(messageRead);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(isAgree){
|
|
|
+ if(StringUtils.isNotEmpty(messageNotice.getDeliverId())){
|
|
|
+ ResumeDeliver resumeDeliver = resumeDeliverService.get(messageNotice.getDeliverId());
|
|
|
+ String chatStatus = resumeDeliver.getChatStatus();
|
|
|
+ int chatStatusNum = Integer.parseInt(chatStatus) + 1;
|
|
|
+
|
|
|
+ resumeDeliver.setChatStatus(String.valueOf(chatStatusNum));
|
|
|
+ resumeDeliver.setUpdateBy(subject);
|
|
|
+ resumeDeliver.setUpdateTime(new Date());
|
|
|
+ resumeDeliverService.update(resumeDeliver);
|
|
|
+
|
|
|
+ ResumeDeliverRecord resumeDeliverRecord = new ResumeDeliverRecord();
|
|
|
+ resumeDeliverRecord.setId(UUID.randomUUID().toString());
|
|
|
+ resumeDeliverRecord.setCreateBy(subject);
|
|
|
+ resumeDeliverRecord.setCreateTime(new Date());
|
|
|
+ resumeDeliverRecord.setDelFlag(false);
|
|
|
+ resumeDeliverRecord.setResumeDeliverId(resumeDeliver.getId());
|
|
|
+ resumeDeliverRecord.setStep("同意");
|
|
|
+ resumeDeliverRecord.setRemark("用户同意");
|
|
|
+ resumeDeliverRecordService.insert(resumeDeliverRecord);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ messageResult.setResult(true);
|
|
|
+ messageResult.setData("保存成功,请等待审批");
|
|
|
+ } catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ log.error(ex.getMessage());
|
|
|
+ messageResult.setResult(false);
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ return messageResult;
|
|
|
+ }
|
|
|
}
|