|
@@ -2,12 +2,16 @@ package com.hssx.cloudmodel.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.hssx.cloudmodel.entity.InvitationRecord;
|
|
|
+import com.hssx.cloudmodel.entity.Project;
|
|
|
import com.hssx.cloudmodel.entity.User;
|
|
|
+import com.hssx.cloudmodel.entity.vo.InvitationRecordVO;
|
|
|
import com.hssx.cloudmodel.entity.vo.UserVO;
|
|
|
import com.hssx.cloudmodel.mapper.*;
|
|
|
import com.hssx.cloudmodel.service.InvitationRecordService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.hssx.cloudmodel.util.HttpRespMsg;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -32,6 +36,8 @@ public class InvitationRecordServiceImpl extends ServiceImpl<InvitationRecordMap
|
|
|
@Resource
|
|
|
CompanyMapper companyMapper;
|
|
|
@Resource
|
|
|
+ ProjectMapper projectMapper;
|
|
|
+ @Resource
|
|
|
CustomCompanyMapper customCompanyMapper;
|
|
|
@Resource
|
|
|
MouldMapper mouldMapper;
|
|
@@ -39,10 +45,17 @@ public class InvitationRecordServiceImpl extends ServiceImpl<InvitationRecordMap
|
|
|
ProjectApproveMapper projectApproveMapper;
|
|
|
@Resource
|
|
|
PowerMapper powerMapper;
|
|
|
+ @Value("${invitation.url.prefix}")
|
|
|
+ private String invitationUrl;
|
|
|
@Override
|
|
|
public HttpRespMsg add(InvitationRecord invitationRecord,String token) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ Project project = projectMapper.selectById(invitationRecord.getId());
|
|
|
+ InvitationRecordVO vo = new InvitationRecordVO();
|
|
|
+ vo.setProjectName(project.getProjectName());
|
|
|
+ vo.setCompanyName(project.getOwnerCompanyName());
|
|
|
User user = userMapper.selectOne(new QueryWrapper<User>().eq("head_imgurl", token));
|
|
|
+ User invitee = userMapper.selectById(invitationRecord.getInviteeId());
|
|
|
if(null == user){
|
|
|
msg.setError("当前角色涉及权限问题,请重新登录");
|
|
|
return msg;
|
|
@@ -51,9 +64,19 @@ public class InvitationRecordServiceImpl extends ServiceImpl<InvitationRecordMap
|
|
|
.eq("operator_id", user.getId())
|
|
|
.eq("project_id", invitationRecord.getProjectId())
|
|
|
.eq("invitee_id", invitationRecord.getInviteeId()));
|
|
|
+ if(null == record){
|
|
|
+ invitationRecord.setOperator(user.getUsername());
|
|
|
+ invitationRecord.setOperatorId(user.getId());
|
|
|
+ invitationRecord.setInvitee(invitee.getUsername());
|
|
|
+ invitationRecord.setAddressUrl(invitationUrl+invitationRecord.getInviteeId()+"/"+invitationRecord.getProjectId());
|
|
|
+ invitationRecordMapper.insert(invitationRecord);
|
|
|
+ BeanUtils.copyProperties(invitationRecord,vo);
|
|
|
+ msg.data = vo;
|
|
|
+ }else{
|
|
|
+ BeanUtils.copyProperties(record,vo);
|
|
|
+ msg.data = vo;
|
|
|
+ }
|
|
|
}
|
|
|
-// HttpRespMsg msg = new HttpRespMsg();
|
|
|
-
|
|
|
- return null;
|
|
|
+ return msg;
|
|
|
}
|
|
|
}
|